Native bullet and forces over a period of time

Hi,

I try to get some understanding how forces are handled in native bullet and which dimensions they have. Most of my questions could probably answered with a yes or no answer. I’m more into physics than into physics engines and need some explanation how common things are handled. I tried my best to find some docs but didn’t succeed and the javadoc isn’t that detailed on the topic. Maybe you have a link for me.

When I apply a force to a rigidbody once every physics frame. Is it scaled with the frame duration of the physics frame? Let’s assume I apply the same force every physics tick and I perform in one simulation with 60 ticks per second and in an other with only 30. Will the body have the same speed in both simulations after 1 second or is the body in the simulation with 60Hz faster?

Do I have to apply a force every second or can I apply it every physics tick and achieve the same result? It probably makes a difference but what is the right way?

I mean in real life you would add a force over a period of time and perform mechanical work. This would change the energy of the whole system. How does bullet handle cases where you only apply a force once and not over a period of time? Should the force be normalized for one second?

If I want to accelerate a body with a mass of 10kg in one second to 10m/s. Do I have to add a force once with:

F = dp/dt = 10kg*10ms^-1/1s = 100N

Or do I have to apply the force every physics tick for one second?
Or do I have to apply the force normalized to the tick duration?

But what happens if I want to accelerate the body in 0.5 seconds. Do I have to add the force of 200N once? Does it have the speed of 20m/s after one second? The conclusion would be that I have to add the force every tick scaled to the tick duration because how should bullet know the duration of the force? Am I right or does bullet the scaling for me?

How can I instantly set the impulse of a body? Can I accomplish this with a force which is scaled to the tick duration?

F = mass * wantedVelocity / tickDuration

I know I could use setVelocity. It seems to me natural to use this method because it is physically not possible to change instantly the velocity. But I’m interested in whether it is possible to use the trick with the tick duration.

And last but not least why would I use applyImpulse if I had understood forces? I mean is there a use case which could only handled by impulses and not by forces?

Thanks for opening my eyes as you always do.

Because since the impulse is the integral over the force, it takes some time until that impulse has reached. If you think of a cannon ball, you don’t want acceleration there. Setting the Force really high and removing it again feels wrong and makes your logic more complicated, so I guess this is the case.

Also internally: If you crash into a wall, the impulse is inverted instead of: The impulse leads to a force, which is inverted which reduces the impulse until it is inverted.

That would be my guess, why you can use setVelocity as well. Games are no simulations but tend to fake things.
For the force I think it has nothing to do with the time:

You specify a force of x Newton and then the engine increases the impulse every tick by x * tick (If you think the other way: You specify the acceleration and it applies it, so you would be second-based and not tick based. That would be the case when setting impulses).

@normen Should have some insight

If you set a force, it is applied in the next tick and then cleared.

http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=1601#p6539

1 Like