Sign in to follow this  
SFA

Vector along the Axis of a Joint

Recommended Posts

SFA    122
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this