Angle between Vectors, with a Twist

Started by
0 comments, last by Zakwayda 18 years, 2 months ago
A month or so ago, I posted this thread about coading an inverse kinematics solver for my project: I've managed to code both a CCD and Jacobian solver, but I'm having some problems adding restrictions to the joint rotations. The way I'm dealing with restrictions is this : for every joint I have initialRotationVector = The default (or starting) rotation of the joint (and therefore bone): initialRotationVector initial Rotation Vector in yellow (translated upwards from bone for view). actualRotationVector = The current rotation of the joint (and therefore bone): initialRotationVector initial Rotation Vector in yellow, actual Rotation Vector in red. The joints only rotate along a single axis (so the joint connecting the leg to the body moves backwards and forwards (rotating on the Y axis)), whilst all the joints in the leg rotate along the X axis. Now for the Y axis joint, the angle between initial and actual rotation can be found easily using a Dot product. I can then check this against max and min angle limit for restricting the rotations (lets say from -30 degrees to +30 degrees). Because the joint is static (joining the leg to the body), its origin doesn't matter. For the X axis joints however, its not that simple. The initial rotation vector is affected by the rotation of the origin Y axis joint. In other words, in the second image the yellow vector should have rotated along with the leg, but maintained the original local height position of the bone. It is THAT angle that I need, the difference in height between both vectors. The problem is, I can't get the intial rotation vector to rotate along the Y axis, but maintain its height. I've tried all kinds of solutions, but I think I'm missing something. Can anyone help?
http://www.voodoo-magic.co.uk
Advertisement
Since no one's answered yet I'll go ahead and mention that I read your post over a couple of times, but couldn't quite figure out what you were asking. I can't comment on the IK stuff, but I'm assuming that the rotation of each bone is expressed in the local coordinate frame of its parent, no? In that case though restricting the x rotation of the lower leg joints should be trivial, so I must be missing something. Also, I'm not sure what you mean by the 'difference in height' between the vectors.

Anyway, if you still need help maybe you could provide a little more detail about the problem.

This topic is closed to new replies.

Advertisement