Set a rotation center point other than 0,0,0 to a scenenode?

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
ChrML
Posts: 30
Joined: Sun Oct 03, 2004 2:45 pm
Location: Norway

Set a rotation center point other than 0,0,0 to a scenenode?

Post by ChrML »

Is that possible? I need this for a physics engine I'm making. ISceneNode doesn't seem to have any member function doing that, and I don't want to do this in the modeller.
djceejay
Posts: 41
Joined: Fri Feb 25, 2005 11:42 am

Post by djceejay »

Rotating by x degrees
Object position o
Centre of rotation c

Rotate it around 0,0,0 by x
Get a vector from the object and the centre of rotation, call it v (v = o-c )
Rotate this vector, v, by x ( v.rotate(x) )
Move the object to the end of the vector v. ( o = c+v )

How about that?
djceejay
Studying :: BSc Computer Games Technology :: UK
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

One way to do it is to create a "dummy" node, with the real node attached as a child at a given offset.
ChrML
Posts: 30
Joined: Sun Oct 03, 2004 2:45 pm
Location: Norway

Post by ChrML »

Oki, maybe I'll use the modeller after all :), as the engine can never know where the rotation center was from before if there are no simple function for it ;). Thanks anyway.
Post Reply