Where is Gravity?

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Where is Gravity?

Postby egyware » Mon Aug 23, 2010 12:26 pm

Hello everyBody.
I'm Newbie with Newton.
In my game put into the world a body attached a HeightFieldCollision with zero unit mass and another body attached a Box with 15 unit mass (for example) but moment of inertia zero (without rotation), Then while running my game the object doesn't move (The graphics position are updated with dynamic body)
The question is:
Where is Gravity?
I try find at http://newtondynamics.com/wiki/index.ph ... ons_in_2.0 some funtions to set Gravity but I don't find anything
I watch some simple tutorials but doesn't necesary set this.
How I Simule my world with Gravity?

I have Newton 2.22 SDK for Windows

PS:
I set Velocity to dynamic body and move it, but the gravity doesn't exist :(
User avatar
egyware
 
Posts: 2
Joined: Mon Aug 23, 2010 10:56 am

Re: Where is Gravity?

Postby Carli » Mon Aug 23, 2010 12:36 pm

NewtonSetForceAndTorqueCallback

use Newton Wiki FAQ
Carli
 
Posts: 245
Joined: Fri Oct 02, 2009 5:28 am

Re: Where is Gravity?

Postby egyware » Mon Aug 23, 2010 1:12 pm

Carli wrote:NewtonSetForceAndTorqueCallback

use Newton Wiki FAQ

THANK YOU!!!!! :D :D :D :D :D :D :D

Check some tutorials I find this
Code: Select all
NewtonBodySetForceAndTorqueCallback(tmp->body, ApplyForceAndTorqueEvent);

Code: Select all
void _cdecl CGame::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;  /// <-------- :D
   force[2] = 0.0f;

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

   NewtonBodyAddForce (body, force);
   NewtonBodyAddTorque (body, torque);
}


Well now I will continue programming
Thank you very much
User avatar
egyware
 
Posts: 2
Joined: Mon Aug 23, 2010 10:56 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 368 guests