[solved] How can I calculate the size of my object?

hoffhoff

15-11-2007 17:01:46

Hello,
I have a mesh, and the getBoundingSphereRadius() function of ogre retrieves me 17. As this mesh represents a person, I could say that my person height is about 34, right?

So, how can I calculate the height of my person in meters? How to convert the ogre´s unit to meters unit?

Because my objects seems to fall very slow for a 10m/s^2 gravity, so I think that I am using the wrong scale.


Thanks

Tubez

15-11-2007 22:29:41

Ogre's units are arbitrary. You can let them be anything you want.

At your current scale, a person is 34 units tall, whereas he would be about 1.70 in the real world. So apparently one unit is 5 cm (do the math).
If you have unit of time that's approximately a second (you'll have to do this on your own, OGRE does not do anything with time advances) then 10 m/s^2 are about 200 * 5cm/s^2. So your gravitational acceleration should be about 200 units.

I recommend choosing your units to be something more workable (like 1m or 1 cm or 1 mm) though.

hoffhoff

16-11-2007 19:31:53

Hey, thanks for replying.

So, I am using the default value of ogrenewt:


void Body::standardForceCallback( OgreNewt::Body* me )
{
//apply a simple gravity force.
Ogre::Real mass;
Ogre::Vector3 inertia;

me->getMassMatrix(mass, inertia);
Ogre::Vector3 force(0,-9.8,0);
force *= mass;

me->addForce( force );
}


So, as my unit represents 5cm, it means that my gravity is just
9,8*5cm/s^2

Then it is near 50cm/s^2?


So, if I want to use the default values of ogrenewt, I should put my ogre´s unit to 1m?

walaber

19-11-2007 05:01:21

yup. of course you can implement your own gravityy for any scale you want, but the easiest thing to do is just choose a scale of 1 unit = 1m, and 1 unit = 1kg, newton seems to be happiest with that scale.

hoffhoff

19-11-2007 23:05:49

Thank you very much.
That explains why my objects seem to fall very slow.
I will fix my mesh files then.

c ya!