OgreNewt 2 crash with simple application

Dragonblood

14-03-2016 03:30:13

Hi,
Here my code:


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

....

OgreNewt::CollisionPrimitives::Box *boxcol = new OgreNewt::CollisionPrimitives::Box(mWorld, this->mNode->getScale(), 0);
OgreNewt::CollisionPtr col = OgreNewt::CollisionPtr(boxcol);

mBody = new OgreNewt::Body(mWorld, col);
mBody->attachNode(this->mNode);
mBody->setPositionOrientation(Ogre::Vector3(0, 50, 5000), Ogre::Quaternion::IDENTITY);

Ogre::Vector3 inertia, centerOfMass;
boxcol->calculateInertialMatrix(inertia, centerOfMass);

inertia *= mPoids;
mBody->setMassMatrix(1.0f, inertia * 1.0f);
mBody->setCenterOfMass(centerOfMass);
mBody->setStandardForceCallback();






my program crash i don"t know why there is no message in Ogre.log.


Help me please
thanks
A+

Lax

20-03-2016 18:40:12

The code looks fine so far. But I see three things:

1. What is the value of 'mPoids' ?
2. I would attach the body to the node, after the position/orientation is set for the body.
3. You are setting your body outside the ogre newt world bounding box.