• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
Calculation of acceleration
09-25-2012, 09:01 AM,
 kidice Junior Member Posts: 5 Threads: 2 Joined: Aug 2012
Calculation of acceleration
Hi everybody,

i'm trying to calculate the acceleration of the user car in real time. I already tried the approach documented in this thread, which says to calculate the acceleration in the updateAction using velocity_delta / dt.

using body->getDeltaLinearVelocity() for the delta_velocity returns me always vector(0,0,0). Does anyone have an hint how to get delta_velocity or any other hint how to calculate the acceleration of a car in real time?

09-25-2012, 02:53 PM,
 NaN Posting Freak Posts: 2,024 Threads: 120 Joined: Jan 2010
RE: Calculation of acceleration
(09-25-2012, 09:01 AM)kidice Wrote: Hi everybody,

i'm trying to calculate the acceleration of the user car in real time. I already tried the approach documented in this thread, which says to calculate the acceleration in the updateAction using velocity_delta / dt.

using body->getDeltaLinearVelocity() for the delta_velocity returns me always vector(0,0,0). Does anyone have an hint how to get delta_velocity or any other hint how to calculate the acceleration of a car in real time?

getDeltaLinearVelocity() is a bullet internal method used in the constraint solver. You have to calculate the acceleration yourself from current and previous velocity.
new_velocity = body->getLinearVelocity();
acceleration = (new_velocity - old_velocity) / dt;
old_velocity = new_velocity;
09-26-2012, 03:12 AM, (This post was last modified: 09-26-2012, 05:16 AM by kidice.)
 kidice Junior Member Posts: 5 Threads: 2 Joined: Aug 2012
RE: Calculation of acceleration
(09-25-2012, 02:53 PM)NaN Wrote: getDeltaLinearVelocity() is a bullet internal method used in the constraint solver. You have to calculate the acceleration yourself from current and previous velocity.
new_velocity = body->getLinearVelocity();
acceleration = (new_velocity - old_velocity) / dt;
old_velocity = new_velocity;

hi nan!
thank you! that piece of code worked for me. I think, I have to get more familiar with bullet

Forum Jump:

Users browsing this thread: 1 Guest(s)