Rotation issue

Apr 29, 2010 at 9:35 PM

I have one sphere, and i want to rotate it. I can rotate it that by adding angle parameter like in Tutorial2 example.

But, problem is because it is always rotating around (0,0), and i want to move axis of rotation on coordinates i want.

When i translate it in CreateObject () on lets say (10,0), all i get is radius of rotation = 10;

Ball translation in CreateObject():

ballTransNode2.Translation = new Vector3(15, 15, 10);
ballTransParentNode = new TransformNode(); 
kockaTransParentNode.Translation = Vector3.Zero;

Ball rotation in Update():

dxmov += gameTime.ElapsedGameTime.TotalSeconds * rotspeed;
ballTransParentNode.Rotation = Quaternion.CreateFromAxisAngle(Vector3.UnitZ, (float)(dxmov));
I guess i'm missing something very simple...

Coordinator
Apr 30, 2010 at 12:34 AM

Just assign the point you want the object to rotate around to ballTransParentNode.Translation

 

Ohan

May 1, 2010 at 5:30 PM

Heh...i knew it was something obvious...

Thanks.