Rotation

tsfn46290

23-03-2008 16:36:19

I have a model that needs to be rotated 90 degrees before it is put into the scene, but I don't quite know how to do that through NxOgre. From what I saw in another post, using sceneNode->yaw() will not work, rather I have to use addTorque and addForce.

Won't this put an acceleration on the object? I just need to rotate it and put it on the floor so it is oriented correctly. Is there an easy way to do this with addTorque and addForce or do I need to make my changes in the model editor.

Thanks!

solaris1912

23-03-2008 16:53:54

create your body this way

scene->createBody(yourmeshname, yourshape, NxOgre::Pose( Vector(0,0,0), Quaternion( Radian( Degree( someDegree ) ), Vector3(0,1,0) ) ) )


This creates your body and rotates it "someDegree" around +Y axis, positiones it at 0,0,0.

If you want to set the bodies rotation after you create it, use


body->setGlobalOrientation( Quaternion(...) )

(hint : you can use the same Quaternion in the first example) :)

tsfn46290

23-03-2008 17:09:09

create your body this way

scene->createBody(yourmeshname, yourshape, NxOgre::Pose( Vector(0,0,0), Quaternion( Radian( Degree( someDegree ) ), Vector3(0,1,0) ) ) )


This creates your body and rotates it "someDegree" around +Y axis, positioned at 0,0,0.

If you want to set the bodies position after you create it, use


body->setGlobalOrientation( Quaternion(...) )

(hint : you can use the same Quaternion in the first example) :)


Excellent, thank you very much!

betajaen

23-03-2008 18:07:35

If the model is always facing the wrong direction, why rotate it using MeshMagick which makes the change more permanent?