How I can join mesh to another mesh by joints?

Software: Away3D 4.x

Shegl, Sr. Member
Posted: 27 February 2012 05:13 PM   Total Posts: 134

Hello everyone. Using 4.0.0.

I have Mesh loaded by md5mesh parser (Body with legs) and have another md5mesh body parts( hands and head) with same skeleton names.

How I can add this parts to main mesh (body with legs)?

Some tutorial, or code help?

mesh event.asset as Mesh;
mesh.material GetCurMaterial(body);
mesh.castsShadows true;
scene.addChild(mesh);
mesh.addChild(placeHolder);

HMesh =  event.asset as Mesh;
HMesh.material GetCurMaterial(head); 

what next I must to do?

   

Leo Brennan, Newbie
Posted: 27 February 2012 05:53 PM   Total Posts: 20   [ # 1 ]

Not got my code in front of me at the moment to give any code examples but an explanation:

you can add the head as a child of the body. This will add the head to the origin position. It will move with any transformations or rotations on the origin joint:

bodyMesh.addChild(headMesh);

To get it moving with a joint that isn’t the origin:

Look at the bodyMesh.animationState and get it’s joints. you can do jointIndexByName(String);
which gives you the joint index, you can use this to access the joint from the joint vector.

then you can get the joint matrix3D and append it to your head mesh.

Search around on the forums, I remember there are a couple posts on it.

   

Shegl, Sr. Member
Posted: 27 February 2012 06:07 PM   Total Posts: 134   [ # 2 ]
Leo Brennan - 27 February 2012 05:53 PM

Not got my code in front of me at the moment to give any code examples but an explanation:

you can add the head as a child of the body. This will add the head to the origin position. It will move with any transformations or rotations on the origin joint:

bodyMesh.addChild(headMesh);

To get it moving with a joint that isn’t the origin:

Look at the bodyMesh.animationState and get it’s joints. you can do jointIndexByName(String);
which gives you the joint index, you can use this to access the joint from the joint vector.

then you can get the joint matrix3D and append it to your head mesh.

Search around on the forums, I remember there are a couple posts on it.

ty a much. 2nd solution is what searching.

   

Shegl, Sr. Member
Posted: 28 February 2012 07:32 PM   Total Posts: 134   [ # 3 ]

2Leo Brennan. Hello again. Im looking on the forum and cant find any posts with jointIndexByName or similar. Can you guys help me with this topic? Ty very much again.

   

Shegl, Sr. Member
Posted: 29 February 2012 06:10 PM   Total Posts: 134   [ # 4 ]

Ok guys I find the prev post for this topic

if (Hmesh && mesh && handIndex && SkeletonAnimationState(mesh.animationState).globalPose.jointPoses.length 0{

Hmesh
.transform = (mesh.animationState as SkeletonAnimationState).globalPose.jointPoses[handIndex].toMatrix3D();

Head now on the neck :D. But she is not animated.
And I repeat my question.
I had 2 joints “Head” with index 47 in body mesh. And the “Head” joint with index 8 in another mesh. How I can join Head mesh to body mesh by this joints?


Btw: head always turned on left now.
http://uoarena.ru/error.png

 

   

Shegl, Sr. Member
Posted: 29 February 2012 06:31 PM   Total Posts: 134   [ # 5 ]

Im so confused.. Very newbie in 3d. But I need to understand how it work.
Help me if u can.

I had put the md5mesh of head and body with idle anim in rar archive
http://uoarena.ru/proguard.rar
and zip
http://uoarena.ru/proguard.zip

Thanx.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X