Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 2 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: btRigidBody accelerating slower than it shouldPosted: Wed Dec 28, 2016 3:57 pm

Joined: Thu Oct 30, 2014 9:15 pm
Posts: 26
I have a btRigidBody with a mass of 1.0 and a linear damping of 0.0. Bullet's default gravity is disabled, and physics are simulated 60 times per second.
There is no air resistance or wind, and no forces affecting the body, except for my custom gravity, which is applied every game tick:
Code:
const btVector3 gravity(0.0,-15.0,0.0);
rigidBody->applyCentralForce(gravity *tDelta); // tDelta = Time between last tick and current tick

If I drop the object from standstill and check its speed (magnitude of getLinearVelocity) after 1 second, the result is exactly 10 every time.
Where could this discrepancy come from? Why is it slower than expected?
My physics knowledge isn't the best, so maybe I'm missing something? Are there any other forces involved that could affect the outcome?

Top

 Post subject: Re: btRigidBody accelerating slower than it shouldPosted: Wed Dec 28, 2016 6:07 pm

Joined: Tue Sep 30, 2014 6:03 pm
Posts: 346
Location: San Francisco
There are two problems:

(1) Your calculation of the force of gravity is wrong. You're computing the delta velocity after one timestep: deltaVelocity = acceleration * deltaTime and then submitting that as a force. Instead you should use this formula: force = mass * acceleration

(2) The btDiscreteDynamicsWorld is hard coded to initialize its gravity to <0, -10, 0> and all dynamic objects that are added to the world will inherit that acceleration by default unless they have manually been set otherwise. This means you're trying to apply gravity wrong. Instead do something like this just once:
Code:
rigidBody->setGravity(btVector3(0.0, -15.0, 0.0));

Alternatively if you want all objects to use that acceleration of gravity you could do this after initializing the world:
Code:
world->setGravity(btVector3(0.0, -15.0, 0.0));

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 2 posts ]

 All times are UTC

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 16 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities