1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| 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, 0), 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(); |
Partager