Quaternion Yaw and NAN

koirat

15-02-2010 16:57:35

This might be a newbie question but.

This sometimes, gives me NAN for this.SceNode.Yaw

this.sceneNode.Yaw(newYaw);


This works properly.

Vector3 lenghtDirection=Vector3.UNIT_Z;
Quaternion quat = new Quaternion((Radian)newYaw, Vector3.UNIT_Y);
this.sceneNode.Orientation = (this.sceneNode.InitialOrientation * lengthDirection).GetRotationTo(quat * lengthDirection);


Can you tell me why ?

Jo0oker

21-02-2010 15:16:06

In my point of view NaN mean: Not a Number.

Check the number with which you turn your Entity.

greets,
Jo0oker

koirat

21-02-2010 22:37:58

I'm not setting it with a NAN.
And in my opinion ScenNode.Yaw should be able to swallow any number.

AndroidAdam

22-02-2010 04:31:11

Set a break point at:
this.sceneNode.Yaw(newYaw);

and see what the value of newYaw is.

If it was never initialized, I think it occasionally throws a NaN exception.

koirat

22-02-2010 09:55:41

It was initialized, we are talking about c# here, it would not compile if not initialized.
And it is a random case, not every number passed gives me NAN in a result as an output. Also i think that this is something concerned with gimbal lock. And that is why the second code I posted is working flawlesly.