Setting Orientation of a node using quaternion, How?

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.
Post Reply
AbsoluteCPP
Posts: 8
Joined: Fri Aug 27, 2010 3:41 pm
Location: Multan, Pakistan

Setting Orientation of a node using quaternion, How?

Post by AbsoluteCPP »

Quat quat = mNode->getOrint();
I have rotation store in a quaternion "quat" and want to apply it to a Irrlicht Animated node, But i found no function that support quaternion.

How can i rotate my irrlicht scene nodes using quaternions???


Thanks.
Can't Be Tamed
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

I think you should convert it to euler
Working on game: Marrbles (Currently stopped).
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Post by sudi »

and then don't forget to convert to degrees. bc i think the toEuler outputs radians and the scenenode expects degrees.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
AbsoluteCPP
Posts: 8
Joined: Fri Aug 27, 2010 3:41 pm
Location: Multan, Pakistan

Post by AbsoluteCPP »

I wrote this code..

Code: Select all

inline static irr::core::vector3df RotationVecPhysXtoIrr(const NxQuat &kQuat) {
			irr::core::vector3df vec;
			irr::core::quaternion quat(kQuat.x, kQuat.y, kQuat.z, kQuat.w);
			//
			quat.toEuler(vec);

			// convert radin to degree
			vec.X *= 57.2957795f;
			vec.Y *= 57.2957795f;
			vec.Z *= 57.2957795f;

			return vec;
		}
It is working properly,

Thanks.
Can't Be Tamed
Post Reply