Force problem...

shoki

25-05-2006 01:27:11

Hi there, again me!

Yes, sorry i've got a problem with gravity (so forces). I don't manage to manipulate forces, maybe because I don't know which mesure I've to use.

For exemple, I'm using the cylinder from the media pack. Then I'm doing that :

Vector3 siz(170,20,20);
bodyNode->setScale( siz );

col = new OgreNewt::CollisionPrimitives::Cylinder(mWorld,20,170,Quaternion(Radian(Degree(90)),Vector3::UNIT_Z));

Vector3 inertia = OgreNewt::MomentOfInertia::CalcCylinderSolid(75.0,0.20,1.70);
bod->setMassMatrix(75.0, inertia);

bod->setCustomForceAndTorqueCallback<Player>(&Player::forceCallback,this);


and my forcecallback :

void Player::forceCallback(OgreNewt::Body* bod){

bod->addLocalForce(Vector3(0,-9,81 * 75.0,0),Vector3::ZERO);

}


I suppose it's in meters because the gravity is 9,81.
I'm using a customcallback because else I can pass through the walls.

I hope you can help me,
thx,
shoki