Re: [Algorithms] Trouble with translating ragdoll joint rotation to animation joint rotation
Brought to you by:
vexxed72
|
From: Megan F. <sha...@gm...> - 2005-02-18 23:35:55
|
Strange, that's exactly what I'm doing.
This is the entirety of my "extrat the joint matrix from the physics
side of thing" code, for instance:
dBodyID parentBodyID =
nOpende::JointGetBody(this->tempLimb->parentJointID, 0);
if (parentBodyID == this->tempBodyID)
parentBodyID = nOpende::JointGetBody(this->tempLimb->parentJointID, 1);
relMat.set(nOpende::BodyGetQuaternion(this->tempBodyID));
relMat.set_translation(nOpende::BodyGetPosition(this->tempBodyID));
matrix44 parentMat;
parentMat.set(nOpende::BodyGetQuaternion(parentBodyID));
parentMat.set_translation(nOpende::BodyGetPosition(parentBodyID));
parentMat.invert_simple();
relMat.mult_simple(parentMat);
... which just does childBodyMat * (parentBodyMat ^1), dumping the
result in relMat. If I stuff the quat from that into the joint in
question, it ends up looking a bit like a mirrored transformation,
where rotations that should be about the X end up going about the Y
axis, etc. Except for in the case of the little test arm, which works
perfectly.
(the bone system more or less takes a 4x4 mat transform relative to
the parent bone, though it breaks it up into a offset/quat/scale)
What I meant about bone axis was that if you specify, say, a negative
offset into a bone's position, you move that bone that distance away
from its parent bone - it's your average parent-relative
transformation hierarchy. So the start position and orientation of
the child bone exists in the space defined by the parent bone's
transformation, which happens to be aligned consistently from bone to
bone (negative X offsets always move you away from the parent bone).
I specified it only to be as specific and accurate as I could.
Meh, if my core algorithm is valid, maybe there's something fishy
going on with the animation code, or there's some part of it elsewhere
doing something I wasn't expecting. Thanks, I'll keep digging.
> If you want parent relative matrices, then you have to do a little
> more work, but not a whole lot. Form the ODE 4x4, then multiply
> that with the inverse of the 4x4 for the parent, and set that as
> your bone matrix.
|