Travis Pettry
Travis Pettry

Reputation: 1352

Urho Node Rotate Around

I am trying to rotate an object around a point in UrhoSharp. I have done a lot of learning on how Quaternions work but he node.RotateAround method dosn't seem to follow the rules.

When w = 0 or PI I seem to get the correct rotation. However, if I use any other number I cannot seem to know which way the object will be rotated.

float w = 0;//or PI
node.RotateAround(point, new Quaternion(Vector3.Up, w) , transformSpace.World);

If anyone has any potints with working with quaterions I would be grateful.

Upvotes: 0

Views: 317

Answers (1)

I think that, for using that constructor, you need to use the quaternion exponential map:

 var q = new Quaternion(Math.Sin(w/2)*Vector3.Up, Math.Cos(w/2));

But perhaps what you want to do is construct from axis and angle:

// note that in this constructor "w" is in degrees, not radians
var q = Quaternion.FromAxisAngle(Vector3.Up, w/2);

Upvotes: 0

Related Questions