dude3d
04-04-2009 09:44:39
Hi all,
I'm very new to OgreNewt. I need help on utilizing the player controller introduced in OgreNewt2.0.
I got the latest OgreNewt from SVN http://svn.ogre3d.org/svnroot/ogreaddons/branches/ogrenewt/newton20 and compiled it against Newton 2.0 Beta. I want to use the player controller to move my character. The following is my code snippet:
With the above code, I use a box as the character but the box doesn't move at all. Can anybody give me some suggesting about what I should change to get the box moving and/or how to use the new player controller? I appreciate if you can share some of your code snippets.
Thanks,
Dude3D
I'm very new to OgreNewt. I need help on utilizing the player controller introduced in OgreNewt2.0.
I got the latest OgreNewt from SVN http://svn.ogre3d.org/svnroot/ogreaddons/branches/ogrenewt/newton20 and compiled it against Newton 2.0 Beta. I want to use the player controller to move my character. The following is my code snippet:
Entity* ent;
SceneNode* node;
Ogre::String name;
Ogre::Vector3 pos = msnCam->_getDerivedPosition();
name = "Body "+Ogre::StringConverter::toString( count++ );
ent = mSceneMgr->createEntity( name, "box.mesh" );
node = mSceneMgr->getRootSceneNode()->createChildSceneNode( name );
node->attachObject( ent );
node->setScale( size );
ent->setMaterialName( "Simple/BumpyMetal" );
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Box( m_World, size );
OgreNewt::Body* body = new OgreNewt::Body( m_World, col );
Ogre::Vector3 inertia = Ogre::Vector3::ZERO;
body->setMassMatrix( 0.0f, inertia );
body->attachNode( node );
body->setStandardForceCallback();
body->setPositionOrientation( Ogre::Vector3(-5,8,0), Ogre::Quaternion::IDENTITY );
body->unFreeze();
OgreNewt::PlayerController* mOgreNewtPlayerController = new OgreNewt::PlayerController(body);
mOgreNewtPlayerController->setVelocity(4, 0, Ogre::Degree(0));
With the above code, I use a box as the character but the box doesn't move at all. Can anybody give me some suggesting about what I should change to get the box moving and/or how to use the new player controller? I appreciate if you can share some of your code snippets.
Thanks,
Dude3D