简体   繁体   English

BulletPhysics 是否会由于重力自动使刚体随时间下降得更快?

[英]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.我刚刚开始使用 Bullet Physics 和 OpenGL,我有一个盒子落在另一个盒子上面。 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.我只是不确定我是否必须手动添加一个事实,即 object 以越来越快的速度落向地面,object 落下的时间越长,或者它是由 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.我目前只有一些盒子落在质量为 0 的更大盒子上,因此它不受重力影响。

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.我尝试将重力从 -9.81 提高到 -1000,但仍然有些不对劲。

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?) . (我上次使用 bullet 已经 10 年左右了,但是某处可能有 addForce 或 addImpulse。必须从 memory 开始每一帧都重新应用脉冲?) In my mind, you should be able to set the force directly as (0, -9.81, 0).在我看来,你应该能够直接将力设置为 (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.因为它不像重力方程那样按物体质量缩放,所以求解器应该使它们以不同的速率下落。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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