position of collision object

yan007

11-04-2006 15:16:01

i have a problem with the position (better orientation) of my collision object, thats my code:

Entity* cil = mSceneMgr->createEntity("Cil", "cilinderMesh.mesh");
SceneNode* cil1 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Cil");
cil1->attachObject(cil);

OgreNewt::Collision* col3 = new OgreNewt::CollisionPrimitives::Cylinder(m_World,19.7,59.1);
OgreNewt::Body* bodyCil = new OgreNewt::Body( m_World, col3 );
delete col3;
bodyCil->attachToNode(cil1);
bodyCil->setPositionOrientation( Ogre::Vector3(50.0, 0.0,50.0), Ogre::Quaternion::IDENTITY );

but my collision object is in a different orientation of my original object, if i use
bodyCil->setPositionOrientation( Ogre::Vector3(50.0, 0.0,50.0), Ogre::Quaternion::IDENTITY * Ogre::Quaternion(Ogre::Degree(90), Ogre::Vector3::UNIT_X));//::IDENTITY );

my original objects rotation changes, but i would like to make that change
on my collision object, how do i do that

walaber

11-04-2006 15:37:18

apply that rotation to the collision object when you create it (when you make the cylinder). this will offset the local orientation of the collision shape.

yan007

11-04-2006 16:49:16

great, it works, thx

TrackGuy

23-08-2006 08:42:46

Hi,

apply that rotation to the collision object when you create it (when you make the cylinder). this will offset the local orientation of the collision shape.

I am having the same problem but I am not sure what you mean with "collision object". The node or the ogrenewt collision object?
If the later, how to apply a rotation to it?

Maybe a silly question but I tried different alternative code snippets and still cannot get it to work :-(

Some extensions to the code sample in the origin posting would help a lot I think ...

regards

walaber

24-08-2006 03:41:11

when you create the collision object, you can pass an offset (vector3), and an orientation (quaternion) to adjust it's position in local space.