Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Difference between Force and Impulse?

Dominus Skye
Bug Magnet
Join date: 31 Oct 2004
Posts: 54
03-04-2005 08:25
Hi,

I'm about ready to start playing with some physical objects. Whilst browsing the wikki to determine the best method of moving an object such as say, getting a ball rolling, I noticed llSetForce, llSetForceAndTorque, and llSetImpulse.

Wonder if anyone can shed some light as to the differences between force and impulse, and how torque applies to the movement of a physical object.

Thanks as always,
Dominus
Catfart Grayson
Registered User
Join date: 16 May 2004
Posts: 264
03-04-2005 08:59
llApplyImpulse provide a single "pulse " of force.

llSetForce sets a constant force that is applied to the oject until you stop it, by using llSetForce(<0,0,0>,TRUE)

Dont forget that even tho' the force might have stopped, inertia will continue to move your object until you counteract it.
_____________________
Cat
Siro Mfume
XD
Join date: 5 Aug 2004
Posts: 747
03-04-2005 11:23
it's always good to read the comments in the wiki

From: someone
llSetForce will set a static force on the rotation it is initially set at. So if you rotate away from it via llSetTorque for instance, or llRotLookAt, the force will still be applied along it's previous axis until it is canceled.

Further, I learned that cancelling the force will not cancel the accumulated velocity. THIS is why it is bad for vehicles. This applies to llSetTorque too. It's not just that the force is applied persistently, it's that the accumulated velocity from that force doesn't go away when the force is canceled. So you'd need to call further functions to cancel the velocity by applying impulses anyway.


Basically since your velocity is still there after you cancel your force, you still have to cancel or modify your velocity. Cancelling is easy if you use a damped motion function like llMoveToTarget, but modifying is hard because inherent delay between a llGetVel and an llApplyImpulse (or llPushObject) will tend to cause a lot of inaccurate impulses/pushes.
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
03-04-2005 23:20
llApplyImpulse is like giving someone a kick in the seat of the pants. llSetForce is like shoving them out the door.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
SuezanneC Baskerville
Forums Rock!
Join date: 22 Dec 2003
Posts: 14,229
03-05-2005 00:03
Getting kicked in the the butt and getting shoved out the door are both apply impulse.

Having a guy in a car nudge up to you and gently make you go faster and faster is set force.

Apply Impulse can be be used to set an objects velocity. The code below is right from the wiki.

Wiki Apply Impulse Page

From: someone

setVel(vector newVel, integer localAxis)
{
vector curVel = llGetVel();

if(localAxis)
{
rotation rot = llGetRot();
curVel /= rot; // Un-rotate curVel.
}

newVel -= curVel;
newVel *= llGetMass();

llApplyImpulse(newVel,localAxis);
}
_____________________
-

So long to these forums, the vBulletin forums that used to be at forums.secondlife.com. I will miss them.

I can be found on the web by searching for "SuezanneC Baskerville", or go to

http://www.google.com/profiles/suezanne

-

http://lindenlab.tribe.net/ created on 11/19/03.

Members: Ben, Catherine, Colin, Cory, Dan, Doug, Jim, Philip, Phoenix, Richard,
Robin, and Ryan

-