Wiki : NewtonBodyGetForce

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Wiki : NewtonBodyGetForce

Postby Sash » Mon Apr 26, 2010 3:48 pm

The page's NewtonBodyGetForce remarks says:
This function is only effective when called from NewtonApplyForceAndTorque callback

Is it true ? Is it really means when called not from callback return values are not valid ?
Last edited by JernejL on Mon Apr 26, 2010 5:51 pm, edited 1 time in total.
Reason: fixed wiki link
Sash
 
Posts: 34
Joined: Wed Sep 30, 2009 3:38 am
Location: Novosibirsk

Re: Wiki : NewtonBodyGetForce

Postby JernejL » Mon Apr 26, 2010 5:52 pm

Since this is the accumulated current force i assume it is not, but you should wait for Julio for a more exact answer.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Wiki : NewtonBodyGetForce

Postby Julio Jerez » Mon Apr 26, 2010 6:23 pm

that was 1.53

I thick in 2.0 there is getForceACC or something similar.
void NewtonBodyGetForceAcc(const NewtonBody* body, dFloat* vector);

some joint use that feature.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Wiki : NewtonBodyGetForce

Postby JernejL » Mon Apr 26, 2010 11:35 pm

Julio Jerez wrote:that was 1.53

I thick in 2.0 there is getForceACC or something similar.
void NewtonBodyGetForceAcc(const NewtonBody* body, dFloat* vector);

some joint use that feature.

This returns current accululated force or for previous frame?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1587
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: Wiki : NewtonBodyGetForce

Postby Julio Jerez » Tue Apr 27, 2010 8:01 am

No, it is in the same frame, It gives the sum of all external forces applied to the body. (excluding teh recation forces).

for example The player controller use it to determine what forces are acting the body , tshi can make a player the can walk of round places, or even on an eviroment with a horizontal gravity.

Code: Select all
void CustomPlayerController::SubmitConstraints (dFloat timestep, int threadIndex)
{
   dFloat mag;
   dFloat angle;
   dFloat invIxx;
   dFloat invIyy;
   dFloat invIzz;
   dFloat invMass;
   dMatrix matrix0;
   dMatrix matrix1;
   dVector velocity;

   // save the gravity before collision force are applied
   NewtonBodyGetForceAcc (m_body0, &m_gravity[0]);
   NewtonBodyGetInvMass(m_body0, &invMass, &invIxx, &invIyy, &invIzz);
   m_gravity = m_gravity.Scale (invMass);
         ...
        ...
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests