Global rotation of joints

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Linkin Puck
Posts: 36
Joined: Sat Feb 06, 2010 11:52 am

Post by Linkin Puck »

You have bumped this topic 8 times. Are you trying to set a world record? :D
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

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...
Image
Image
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

I'm just amazed he modeled in the vagina and nobody has mentioned it yet lol
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

vaginas are very essential for projects ;)
Image
Image
MrJones
Posts: 15
Joined: Sun May 23, 2010 1:02 pm

Post by MrJones »

I need this feature aswell.

Is there really nothing like setAbsoluteRotation()? It seems pretty much impossible to rotate a bone towards an absolute position independently from its parent's rotation.

Isn't there a way to do this?
blub
xDan
Competition winner
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK
Contact:

Post by xDan »

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 :P Well it did something in some circumstances, I forget what though.

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);
}
MrJones
Posts: 15
Joined: Sun May 23, 2010 1:02 pm

Post by MrJones »

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.
blub
Post Reply