Pick part of bones to rotate

Started by faridrakh, February 27, 2015, 12:26:02 PM

Previous topic - Next topic

faridrakh

i have bones file. i want to select 1 part of my file to rotate.
how i can get access to my bones joint?
how can  i cast animated group to animated 3d?

raft

have a look at ProceduralAnimationSample sample.

you cant cast AnimatedGroup to Animated3D but can access Animated3D's in the group by get(index/name) methods.

faridrakh

thank you. i followed ProseduralAnimationSample.java.
but my skeleton  and my mesh model not in same position.
my skeleton a bit lower form my mesh model.
in blender my model and my armature is okay.


raft

i dont know why. i remember sometimes in 3d max when you move model during rigging, such strange things was happening. it has a reset xform modifier or something like, which mostly solves the situation. no idea what to do in blender.

faridrakh

#4
i already solved the model . And now i can tranlate and rotate the skeleton with this code.


Joint pointing  = currentPose.getSkeleton().getJoint(15);
final Joint parentJoint = currentPose.getSkeleton().getJoint(pointing.getParentIndex());
final Matrix global= new Matrix(pointing.getBindPose());
global.translate(10,10,10)
global.matMul(parentJoint.getInverseBindPose());
currentPose.getLocal(pointing.getIndex()).setTo(global);
currentPose.updateTransforms();
skeletonDebugger.update(currentPose);


the joint at index 15 stretch. but my mesh not. i want the parent joint following, like seymour neck in ProceduralAnimationSample.
how i can do like that? i don't know where the mistake, in the program or my model.

raft

well to tell the truth, i'm not proficient at those calculations too :/

did you see this post, it may help:
http://www.jpct.net/forum2/index.php/topic,3300.0.html

faridrakh

#6
is matrix translate different form object 3d translate?
when i used matrix translate and object3d translate with same value, giving different output.
can i cast matrix to object 3d? because i want to make augmented reality, that my object translate where my marker position.

in the picture my marker is the white circle. if i use matrix translate, i cant move to the white circle.
but if i use .obj file with object3d translate , i can move to white circle.

any idea?

raft

which matrix are you talking about? Object3D.getTranslationMatrix().translate(..) and Object3D.translate(..) should give the same result.

no, you cant cast Matrix to Object3D. you can find many posts about AR in the forums.

faridrakh

   Joint pointing  = currentPose.getSkeleton().getJoint(15);
final Joint parentJoint = currentPose.getSkeleton().getJoint(pointing.getParentIndex());
final Matrix global= new Matrix(pointing.getBindPose());
global.translate(x,y,z);
global.matMul(parentJoint.getInverseBindPose());
currentPose.getLocal(pointing.getIndex()).setTo(global);
currentPose.updateTransforms();
skeletonDebugger.update(currentPose);


global.translate giving different position from object3d.translate()

raft

you are modifying a joint's translation. that has nothing to do with the Object3d's (Animatd3D indeed) translation.

faridrakh

So how i can move the joint? Ex: i want to move my joint to (240,200,10) this is my marker position.

raft

what do you mean by moving the joint? if you mean you want your model's finger (or whatever) point to that direction, you should first calculate the direction and apply to joint.

again ProseduralAnimationSample may help. Chase's helper class may also help:

faridrakh

thank you. i already can move my finger to my desire location. Can but parent mesh not follow the object rotation. how can i calculate the rotation to make the parent mesh like follow the child? and is the skeleton helper can move the joint and follow by the parent joint?

raft

Quote from: faridrakh on March 12, 2015, 12:39:21 PM
and is the skeleton helper can move the joint and follow by the parent joint?
i guess so. Chase may give more detail about that

Quote from: faridrakh on March 12, 2015, 12:39:21 PMCan but parent mesh not follow the object rotation. how can i calculate the rotation to make the parent mesh like follow the child?
in jPCT you can add an object as child of another. so when parent is moved/rotated child follow same move/rotation.

faridrakh

what mat to fill in transformJointOnPivot(Joint joint, Matrix mat)? i only know simplevector to translate