Joint orientation - matrix.pointAt

Software: Away3D 4.x

yomyom, Newbie
Posted: 29 August 2016 10:03 PM   Total Posts: 11

hello,
I’m trying to animate a tube with joints programmatically
This is how I proceed:

step 1: Generate an array of coordinates (vector3D) for each frame
step 2: Based on these coordinates, generate an array of joint rotations (quaternion) for each frame : each joint is oriented toward the next one
step 3: Then based on these arrays, create the skeletonPose->skeletonClipnode and play the animation using timeSkeletonAnimator.

It works almost well,  I have an issue with step 2 : To orientate the joint toward the next one, I use this function

matrix.pointAt(nextJoint,Vector3D.X_AXISVector3D.Y_AXIS);
quaternion.fromMatrix(matrix); 

When the orientation of the joint is close to the vertical, the joint spins around the vertical axis.  it’s hard to explain the issue with my bad english so I’m going to draw it.
You can find attached to this post my amazing drawing (Excel powered)

Is there another way to achieve something similar (orienting the joints) with another function?

I hope someone will be able to help me out.

 

Image Attachments
issue.JPG
   

Tempy111, Sr. Member
Posted: 30 August 2016 07:52 AM   Total Posts: 128   [ # 1 ]

not a great help but any reason to do this all via code instead of making a model with a skeleton and animating it before importing?

Oh and, your image shows the X and Z axis, but the point code uses the X and Y. maybe the Y_AXIS should be replaced with Z_AXIS

   

yomyom, Newbie
Posted: 30 August 2016 05:29 PM   Total Posts: 11   [ # 2 ]

Thank you for your answer!

Tempy111 - 30 August 2016 07:52 AM

not a great help but any reason to do this all via code instead of making a model with a skeleton and animating it before importing?

Yes, there is.
Basically the models are generated based on external binary data.

Tempy111 - 30 August 2016 07:52 AM

Oh and, your image shows the X and Z axis, but the point code uses the X and Y. maybe the Y_AXIS should be replaced with Z_AXIS

Well, you are right. Actually, while I was “drawing” my explanation, I didn’t care about the name of the axis as the main issue is not about which axis is the right one.  My bad. My issue is that the function matrix.pointAt doesn’t give me some “stable” axis (sign) when the orientation is close to the vertical.

I was hoping that there is a tool somewhere, like a working “matrix.pointAt” or something else which can help me to orientate my joints. But I’m afraid I will have to code it as well…

   

yomyom, Newbie
Posted: 07 September 2016 03:35 PM   Total Posts: 11   [ # 3 ]

Hello!
My question is related to the same subject : instead of using “Matrix.pointAt” I want to rotate my quaternion manually. But the results are weird. I think I’m doing something bad:

var quaternion:Quaternion = new Quaternion();
quaternion.fromAxisAngle(Vector3D.Z_AXIS90);
trace(quaternion.x+" "+quaternion.y+" "+quaternion.z); 
// 0 0 0.8509035245341184
// I was expecting 0 0 1.5708 
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X