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_AXIS, Vector3D.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.