llApplyImpulse(vector force, integer local)
If an
object is
physical, this
call applies a single
push in a specific direction to the object defined by the
argument force. If
local is
true,
force is applied along the object's
local axis, otherwise it is applied along the
global axis.
Note: unlike
llApplyRotationalImpulse,
llApplyImpulse does work on
attachments.
Because there is no air friction, any impulse off the vertical (gravity) axis will cause the object to keep moving forever. Hence, this can be used to set a velocity.
To set the object's
velocity using
llApplyImpulse():
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);
}
Compare with
llApplyRotationalImpulse.
- In order to give an object a specific speed and direction, use the momentum equation: p=m*v where v is the target velocity vector and m is the mass of the object.
llApplyImpulse(llGetMass()*<0,0,10>,FALSE);
//10 meters per second upwards
//Gravity will slow the object down immediately and make it fall back
To overcome
gravity effects, use a force which, unlike an impulse, is constant over
time:
To stop a moving object dead in its tracks, apply an impulse to counter its current impulse:
llApplyImpulse(-llGetMass()*llGetVel(),FALSE);
//This will cancel the speed of an object that has no other forces set on it
//and will cause it to stop in place relative to the ground
Q:Is it possible to apply Impulses to other peoples objects that havn't been scripted to do so?
Limitations
The actual impulse may be less than requested for two reasons.
- The push vector magnitude is limited to 20,000. Anything over this is scaled back to a magnitude of 20,000.
- The push vector is always scaled by the energy of the object. For relatively small objects (say, smaller than an avatar), the object's energy is likely to be 1.0, in which case there will be no effect. However, for large objects, or objects that are being manipulated a lot, the energy may be anywhere from 0.0 to 1.0, and the effect can be very sizeable. See energy for more details on how energy is calculated.
This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.
Functions | Dynamics | Force | Impulse Jasa SEO Jasa SEO Murah Sepatu Online Toko Sepatu Online Sepatu Sepatu Murah Sepatu Safety Sepatu Futsal Cheapes Hostgator Coupon Link Booking Televisori offerte Notebook Offerte Berita Terkini Internet Marketer Muda Internet Marketer Indonesia Portatile Apple RDAnet Lorks Karikatur Bisnis Modal Kecil Bisnis UKM Berita Terbaru Iklan Baris Jasa SEO Jasa SEO Murah SEO Indonesia Konsultan SEO SEO Belajar SEO Kursus SEO Kursus SEO Murah Jam Tangan Casio Jam Tangan Casio Jam Tangan Murah Jam Tangan Grosir Baju Terbaru Grosir Baju Baju Terbaru Grosir Baju Murah Bisnis Online Belajar SEO Kerupuk Kerupuk kulit Social Bookmark Dofollow Social Bookmark Kumpulan Puisi Kirim Puisi bola hantu Penumbuh Rambut Penumbuh Rambut timbangan WBC Wonogiri Jasa SEO Murah Jasa SEO Jam Tangan Murah