Newton cube falling up

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
theFALCO
Posts: 6
Joined: Sat Mar 17, 2007 8:41 pm

Newton cube falling up

Post 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?
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

Maybe you'r adding a positive y-value in your onapplyforcesandtorque?
If you don't have anything nice to say, don't say anything at all.
roxaz
Posts: 575
Joined: Tue Jan 23, 2007 8:35 pm
Location: LT

Post 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 ;)
Post Reply