Jump to content
  • Advertisement
Sign in to follow this  
SFA

Vector along the Axis of a Joint

This topic is 5121 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi folks. I'm developing a limb simulator using Inverse Kinematics and I've been wrestling with a problem with quite some time now! I'm following Hugo Elias' implementation/tutorial, which you can find HERE Now the problem I've got is with this : a. Vector along the axis of the joint. b. Vector along the bone. r. Vector at Right angles to a and b. f. Force vector, from End Point to Target. What I do at the moment is :

//i.e get position of bone joints
Vector3 a = bone1->getWorldPosition(); //current bone 	
Vector3 b = bone2->getWorldPosition(); //next bone
Vector3 c = bone0->getWorldPosition(); //previous bone

//Get vectors along bones
Vector3 vectAlongBone1 = (a - b);
Vector3 vectAlongBone2 = (a - c);

//Use Cross Product to get vector along axis Joint
Vector3 A = vectAlongBone1.crossProduct(vectAlongBone2);
	A.normalise(); 
Should this work for a hinge joint? I'm getting some strange results. At certain rotations, the last joint in the limb's 'Vector along the Axis of the Joint' (Vector A) will flip over, so that this (top down view):
        0
        0
        0
A ------0
Becomes this :
0
0
0
0------ A
Or in numerical form : This : 1,0,0 Becomes This : -1,0,0 I've tried restricting the axis, but that breaks when a joint on another axis does any rotation... So, is there a flaw in my resoning here? I would be very grateful for any help! SFA.

Share this post


Link to post
Share on other sites
Advertisement
Pre calculate the joint vector and transform into model space like any other normal.
The cross product method fails if the joint is at 0 or 180 degrees anyway (returns zero vector).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!