How2 apply forces

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

How2 apply forces

Postby blackbird_dream » Fri Nov 24, 2017 11:40 am

I'm not familiar yet with this version
With the former version I used callbacks to apply torsors on bodies :
Code: Select all
NewtonBodySetForceAndTorqueCallback

then in the callback I used :
Code: Select all
force := AffineVectorMake(0,0, -GRAVITY * mass) ;
  NewtonBodySetForce(body, @force) ;

and accumulators
Code: Select all
AddForceAtPos (from newtonutil.pas) and Newtonbodyaddtorque(from NewtonImport.pas)


Now I'm using Unity3D
I believe I need to override the event OnApplyForceAndTorque.
My question is Do I just need to apply extra forces with
Code: Select all
body.GetBody().AddForce
?
Or I must set the acceleration force before in the event ? I guess I just need to add the extra forces as the gravity force is already taken into account but I'm not sure how to do.
User avatar
blackbird_dream
 
Posts: 354
Joined: Wed Jun 07, 2006 3:08 pm
Location: France

Re: How2 apply forces

Postby Sweenie » Fri Nov 24, 2017 1:03 pm

That is correct. Check demo 3 for example.
we should add those functions to the NewtonBody class instead, but for now use getbody().addforce
Sweenie
 
Posts: 498
Joined: Mon Jan 24, 2005 7:59 am
Location: Sweden


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron