Simple application

Cookiezzz

15-06-2011 16:04:50

Hi,

I tested OgreNewt and the Tutorial in the Ogre-wiki, but it doesnt work. It says


Unbehandelte Ausnahme bei 0x68cdffeb in Test.exe: 0xC0000005: Zugriffsverletzung beim Schreiben an Position 0x5a95d694.


Does anybody know an other good tutorial or basic OgreNewt application?

Cookiezzz

razi

15-06-2011 21:49:51

how about you into ogre3d ogrenewt-less application include ogrenewt.h and the at start do

OgreNewt::World* m_World = new OgreNewt::World();
m_World->setWorldSize(Vector3(-1000,-1000,-1000),Vector3(1000,1000,1000));

Entity* ent = mSceneMgr->createEntity( "mEntity", "cone.mesh" );
SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("mNode");
node->attachObject( ent );

OgreNewt::ConvexCollisionPtr col = OgreNewt::ConvexCollisionPtr(new OgreNewt::CollisionPrimitives::ConvexHull(m_World,ent,1));
body = new OgreNewt::Body( m_World, col );
Ogre::Vector3 inertia, offset;
col->calculateInertialMatrix(inertia, offset);
#ifdef OGRENEWT_NO_COLLISION_SHAREDPTR
delete col;
#endif

body->setMassMatrix( 2, 3.0*inertia );
body->setCenterOfMass(offset);
body->setPositionOrientation( Ogre::Vector3(0.0,15.0,0.0), Ogre::Quaternion::IDENTITY );
body->attachNode( node );
body->setStandardForceCallback();

And in runtime call

m_World->update(timeSinceLastFrame);

I didnt test it but it show work making whatever mesh you choose to fall down. Also check what Newton version you have, version 2.24 version last time I checked, then there were some bigger changes in Newton.