Global rotation of joints
-
Linkin Puck
- Posts: 36
- Joined: Sat Feb 06, 2010 11:52 am
8 times? i think its more than that. but if some kind programmers would answer, and not bury this topic, then i wouldnt have to bump.
you know, even if you guys ignore this topic, the problem still appears. check the first time i asked for help. its april 13. and now its may 19, and still no answer. i just only get very helpful answers like ur post, but nothing usable (except scarabol, and arras)
i hate how ppl ask something, i answer, then they never return to this topic...
you know, even if you guys ignore this topic, the problem still appears. check the first time i asked for help. its april 13. and now its may 19, and still no answer. i just only get very helpful answers like ur post, but nothing usable (except scarabol, and arras)
i hate how ppl ask something, i answer, then they never return to this topic...
just for the record, I had a go at this since I might want it sometime, but I gave up with a headache...
I got this, which, er, doesn't seem to work
Well it did something in some circumstances, I forget what though.
I got this, which, er, doesn't seem to work
Code: Select all
void SetAbsoluteRotation(scene::ISceneNode *node, core::vector3df absoluteRot)
{
// Could perhaps recurse.
if (node->getParent())
node->getParent()->updateAbsolutePosition();
node->updateAbsolutePosition();
// Old absolute rotation
core::quaternion qOldRotAbs( node->getAbsoluteTransformation().getRotationDegrees() * core::DEGTORAD );
// Desired new absolute rotation
core::quaternion qDesiredRotAbs( absoluteRot * core::DEGTORAD );
// Delta
core::quaternion qDelta;
core::quaternion qOldRotAbsInv = qOldRotAbs;
qOldRotAbsInv.makeInverse();
qDelta = qOldRotAbsInv * qDesiredRotAbs;
// Relative rotation
core::quaternion qOldRelative(node->getRotation() * core::DEGTORAD);
// Result!
core::quaternion result = qOldRelative * qDelta;
// Set
core::vector3df euler;
result.toEuler(euler);
node->setRotation(euler * core::RADTODEG);
}This looks perfect - and it does not work?
that's pretty sad, because it looks _exactly_ like the thing I actually wanted. Need to test this out...
If I had to do it myself I'd do it in a similar way (using quaternions). Sadly my maths are probably bad enough that I cannot even fix yours.
What about adding ->setAbsoluteRotation() to the engine core? It would be pretty useful e.g. for pistols or also if you want the head of a character to look at a specific thing.
If I had to do it myself I'd do it in a similar way (using quaternions). Sadly my maths are probably bad enough that I cannot even fix yours.
What about adding ->setAbsoluteRotation() to the engine core? It would be pretty useful e.g. for pistols or also if you want the head of a character to look at a specific thing.
blub

