Page 1 of 1

Newton cube falling up

Posted: Sat Mar 17, 2007 8:44 pm
by theFALCO
I have the freshest (official) Irrlicht and Newton
I have created a cube and it is simulated by Newton but it kinda falls UP and I think it should go down...

any idea how this might happen and how to fix it?

Posted: Sat Mar 17, 2007 8:57 pm
by Luben
Maybe you'r adding a positive y-value in your onapplyforcesandtorque?

Posted: Sat Mar 17, 2007 10:38 pm
by roxaz
my ApplyForceAndTorqueEvent callback:

Code: Select all

void _cdecl Physics::ApplyForceAndTorqueEvent (const NewtonBody* body) 
{ 
   float mass; 
   float Ixx;
   float Iyy; 
   float Izz; 
   float force[3]; 
   float torque[3]; 

   NewtonBodyGetMassMatrix (body, &mass, &Ixx, &Iyy, &Izz); 

   force[0] = 0.0f; 
   force[1] = NEWTON_GRAVITY * mass; 
   force[2] = 0.0f; 

   torque[0] = 0.0f; 
   torque[1] = 0.0f; 
   torque[2] = 0.0f; 

   NewtonBodyAddForce (body, force); 
   NewtonBodyAddTorque (body, torque); 
}
take a closer look at force[1] = NEWTON_GRAVITY * mass;
set NEWTON_GRAVITY so something negative. -800 for me works just fine ;)