[Solved] Scale Ogre Mesh in NxOgre?

gbisocoli

16-10-2011 19:53:42

Hi, I created a Ball (sphere), this is the code:

// Create ball material
MaterialDescription mat;
mat.mDynamicFriction = 0.05f;
mat.mStaticFriction = 0.05f;
mat.mRestitution = 1.0f;
mBallMaterial = mNxOgreScene->createMaterial(mat);

// Body description
Critter::BodyDescription bodyDescription;
bodyDescription.mMass = 0.45f; // 450 gr

// Sphere description
NxOgre::SphereDescription sphere;
sphere.mRadius= 11.14;
sphere.mMaterial= mBallMaterial->getIdentifier();

// Finally create the body.
mBody = mRenderSystem->createBody(sphere, ( NxOgre::Vec3(NxOgre::Math::random(0,100),NxOgre::Math::random(0,100),NxOgre::Math::random(0,100)) ), "sphere.mesh", bodyDescription);


The "sphere.mesh" appears huge in comparison with the NxOgre sphere, the dimension I want to keep is the NxOgre (radius: 11.14 which is the official dimension for a soccer ball).

There is this method on Ogre that can change the radius but the createBody method only accepts a string containing the name of the mesh...

void _setBoundingSphereRadius (Real radius)
Manually set the bounding radius.


How can I change the sphere.mesh dimension on NxOgre?

gbisocoli

17-10-2011 20:09:44

I found it!

This code did it:

mBody->getNode()->setScale(0.1114);

Thanks anyway.