applyForce and applyImpulse

Hi all

I’m about to play with Python to make a simple movement script. At the minute I am using applyForce but there is also applyImpulse - can someone answer these questions for me:

What is the difference between them?

What situations suit them?

I’m guessing applyForce applies a set amount of force over time whilst Impulse applies the force all in one go, but I’m confused as when to use them.

Cheers for your time!

Paul

One difference is that impulse can be applied at any position on the object - while force is always applied at the center.

I’m not sure there’s any other difference - The naming imply the difference You mention but it seams like force is only applied for one logic tic so it’s basically a impulse too. The naming also imply different values (force imply force and impulse imply energy) but I don’t know if that’s the case. I really want to know the difference too.

Edit: A force applied a certain time is basically energy so the difference there is not really a difference.

Edit2: Thanks for the question! I just realized that apply is not the same as set - and it works, You can apply two opposite forces and the result is nothing - like it should! Useful!

Edit3: I got it figured out - apply impulse use the energy of a force applied one second. So force/60 makes it equal to apply force - and they do interact - I applied force in one direction and applied impulse force/60 in the opposite direction and the object stayed still!!!

So - apply impulse is always in world coordinates and logic tic-rate times stronger but You can on the other hand apply it where You want!

My understanding is pretty much as LaH said above, but I can add that applyImpulse will only have it’s full effect on ‘rigid body’ objects. ‘Dynamic’ objects are affected by forces, but do not have physics based rotation, only movement. ‘Rigid body’ objects have physics based movement (momentum) and physics based rotation (angular momentum).

applyForce acts on the object centre so will not affect angular momentum. applyImpulse can be applied to any point on an object. If this point is through the object centre then there will be no rotation, but if the point where the impulse is applied is off-centre then the impulse will cause rotation in addition to motion.

I hope this makes sense, I’m posting from my phone so can’t really proof read my post.

Basically, applyImpulse will only make sense when used with ‘rigid body’ objects and should only be used when you want the force to affect rotation. An example might be when shooting a ragdoll and you want it to recoil from the bullet wound and spin.

then
applyImpulse is a kind of rotation. (but prevents you from doing so many calculations)
well exaplain above

this is ok

Instead applyForce not convince me, I do not see where the difference with lineaVelocity …

ob. applyForce ([0,1,0], 1)
and
ob.localLinearVelocity[1] + = 1

seem the same

I think I have a better idea now- cheers guys!

@MarcoIT: Those two lines of code will most likely achieve the same results (I haven’t checked them). However, the result will only be the same for objects with a mass of 1. If you have objects with different masses then the two lines of code will achieve different results. If an object has a mass of 2 then when using applyForce you will need to double the force or double the length of time that the force is applied in order to achieve the same effect as incrementing the localLinearVelocity by 1.

applyImpulse is not a kind of rotation. It simply applies a force at a virtual point on the object.
Example: you are kicking a ball.

The results is a combination of motion and rotation dependent on the impulse vector and the hit point (think about billiard).

The difference between force and velocity is what you hopefully learned in school (see Physics).

From Wiki:

velocity is the measurement of the rate and direction of change in the position of an object.
The speed of an object is the magnitude of its velocity.

force is any influence that causes an object to undergo

  • a change in speed,
  • a change in direction, or
  • a change in shape
    … an impulse … is defined as the integral of a force with respect to time.

Bullet (the physics engine) tries to simulate these definitions. Please keep in mind Bullet calculates in BUs. And do not forget the time! :wink:

I hope it makes some things more clear.

Cool- cheers!

Well,appyImpulse, if it is not applied exactly in the center causes “ALSO”, a rotation.
then??? boh
!

“The Difference Between Force and Velocity is hopefully what you learned in school”

speed:
“Some kind of change of position”

6+

Speed is more precise than that - it is how much position change any given time.

Speed is something You set. If You set it several times in the same tic only the last one counts, not the others, not the previous speed.

Force is a power that cause object to change speed over time. It is applied, meaning if You apply it several times the same tic all apply and influence the speed - also the previous speed counts.

Speed can be linear or angular (rotation speed). Apply force is applied at the objects center and does those effect only linear speed. Apply impulse may be applied at any point so it may also affect angular speed.

Both apply force and apply impulse is really impulses. Apply force have the energy of the force applied one tic, apply impulse have the energy of the force applied on second (but it’s all applied in one tic) - normally in the BGE that’s 60 times more.

true :wink: