www.jpct.net

Bones - Skeletal and Pose Animations for jPCT/jPCT-AE => Bones => Topic started by: faridrakh on February 27, 2015, 12:26:02 pm

Title: Pick part of bones to rotate
Post by: faridrakh on February 27, 2015, 12:26:02 pm
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?
Title: Re: Pick part of bones to rotate
Post by: raft on February 27, 2015, 12:40:20 pm
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.
Title: Re: Pick part of bones to rotate
Post by: faridrakh on February 28, 2015, 02:43:24 am
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.

Title: Re: Pick part of bones to rotate
Post by: raft on February 28, 2015, 05:09:27 am
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.
Title: Re: Pick part of bones to rotate
Post by: faridrakh on February 28, 2015, 02:38:27 pm
i already solved the model . And now i can tranlate and rotate the skeleton with this code.

Code: [Select]
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.
Title: Re: Pick part of bones to rotate
Post by: raft on February 28, 2015, 03:11:19 pm
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
Title: Re: Pick part of bones to rotate
Post by: faridrakh on March 01, 2015, 11:58:56 am
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?
Title: Re: Pick part of bones to rotate
Post by: raft on March 01, 2015, 03:12:45 pm
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.
Title: Re: Pick part of bones to rotate
Post by: faridrakh on March 01, 2015, 03:19:53 pm
Code: [Select]
   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()
Title: Re: Pick part of bones to rotate
Post by: raft on March 01, 2015, 03:25:11 pm
you are modifying a joint's translation. that has nothing to do with the Object3d's (Animatd3D indeed) translation.
Title: Re: Pick part of bones to rotate
Post by: faridrakh on March 01, 2015, 03:29:33 pm
So how i can move the joint? Ex: i want to move my joint to (240,200,10) this is my marker position.
Title: Re: Pick part of bones to rotate
Post by: raft on March 01, 2015, 03:34:56 pm
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 (https://gist.github.com/Chase-san/5253808) may also help:
Title: Re: Pick part of bones to rotate
Post by: faridrakh on March 12, 2015, 12:39:21 pm
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?
Title: Re: Pick part of bones to rotate
Post by: raft on March 12, 2015, 02:00:36 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

Can 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.
Title: Re: Pick part of bones to rotate
Post by: faridrakh on March 12, 2015, 02:12:07 pm
what mat to fill in transformJointOnPivot(Joint joint, Matrix mat)? i only know simplevector to translate
Title: Re: Pick part of bones to rotate
Post by: raft on March 12, 2015, 02:14:39 pm
is that SkeletonHelper? I never used it myself. but possibly you create an identity matrix, translate it and pass to that mtthod
Title: Re: Pick part of bones to rotate
Post by: faridrakh on March 21, 2015, 11:56:57 am
you procedural animation saved me. my finger now can move.

can i select a mesh from animated group? example i want to select my fingertip. can i select fingertip mesh?
Title: Re: Pick part of bones to rotate
Post by: raft on March 21, 2015, 05:32:37 pm
you can select Animated3D's in an AnimatedGroup either with index or with name. have a look at AnimatedGroup.get(int/String) methods
Title: Re: Pick part of bones to rotate
Post by: faridrakh on April 07, 2015, 10:41:21 am
what should i do if i want to export multiple mesh ogre to bones?

"jmeOgre2Bones -out bone.bones -in mes1.xml mesh2.xml" like this giving error number of vertices differ

my model in 1 blender file
Title: Re: Pick part of bones to rotate
Post by: raft on April 07, 2015, 03:56:17 pm
"jmeOgre2Bones -out bone.bones -in mes1.xml mesh2.xml" is for merging multiple animations into one. that's why the meshes and skeletons should be identical.

(although I didnt use it) you should be able to export multiple meshes from Blender. In 3d Max OgreMax plugin can export multiple meshes.