简体   繁体   中英

Does BulletPhysics make rigid bodies fall faster over time due to gravity automatically?

I have just began using Bullet Physics with OpenGL and I have a box that falls on top of another box. I'm just not sure if I have to manually add the fact that an object falls toward the ground at a faster and faster velocity the longer the object falls or is it done automatically by Bullet Physics.

I have also noticed that multiple objects of different masses fall at the same rate, but I've seen lots of posts about this and that the mass does not affect the gravity force (which is obviously). I'm trying to make objects fall faster (increase its velocity) the heavier it is.

At this point I'm just lost in all the answers to similar questions I've seen and can't make out what am I supposed to do to achieve this.

I currently only have some boxes falling onto a bigger box that has mass 0 so it's not affected by gravity.

The objects seem like they're floating almost. I tried upping the gravity from -9.81 to even -1000 and something still doesn't look right.

Typically a physics engine will compute the acceleration during its physics step, eg

a = F/m

Given that gravity is computed as

Fg = G*m

The masses cancel out, and you should end up with a constant acceleration, eg

a = (0, -9.81, 0)

So yes, it is expected that all objects fall at the same speed.

One option to achieve different fall rates is to adjust the drag coefficients based on mass. Slippy objects will fall fastest, those with high drag coefficients will fall slower.

Alternatively you can apply your own forces to the rigid bodies. (It's been 10 or so years since I used bullet last, but there's probably an addForce or addImpulse somewhere. Impulses have to be reapplied every frame from memory?) . In my mind, you should be able to set the force directly as (0, -9.81, 0). Because that isn't being scaled by the objects mass as with the gravity equation, the solver should make them fall at differing rates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM