Difference between revisions of "LlSetForce"

From Second Life Wiki
Jump to navigation Jump to search
 
m (Replaced <source> with <syntaxhighlight>)
 
(19 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{LSLFunctionAll|func_id=64|func_sleep=0.0|func_energy=10.0|func=llSetForce|p1_type=vector|p1_name=force|p2_type=integer|p2_name=local|func_footnote=sets force on object, in local coords if local == TRUE (if the script is physical)|return_text|spec|caveats|examples|helpers|related|also|notes}}[[Category:LSL_Functions]][[Category:LSL_Stub]]
{{LSL Function
|inject-2={{LSL_Function/force|force|local=local}}{{LSL_Function/physical}}
|func_id=64
|func_sleep=0.0
|func_energy=10.0
|func=llSetForce
|p1_type=vector|p1_name=force|p1_desc=directional force
|p2_type=integer|p2_subtype=boolean|p2_name=local
|func_footnote=Continuous force. [[llApplyImpulse]] has instantaneous push.
|func_desc=Applies force to the object (if the object is physical)
|spec
|caveats=Only works on physical objects and attachments (non-physical as well as physical).  Used on an attachment, it will apply the force to the avatar.
|constants
|examples=<syntaxhighlight lang="lsl2">//A simple rocket script. Launches object up when touched.
//Sit on it for an interesting ride!
default
{
    touch_start(integer i)
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetForce(<0,0,0x7FFFFFFF>, 0);  //FLY!
    }
}</syntaxhighlight>
|helpers
|also_functions={{LSL DefineRow||[[llSetForceAndTorque]]|}}
{{LSL DefineRow||[[llSetTorque]]|}}
{{LSL DefineRow||[[llApplyImpulse]]|Instantaneous force}}
|also_tests
|also_events
|also_articles
|notes
|cat1=Physics
|cat2=Movement
|cat3
|cat4
}}

Latest revision as of 22:52, 30 May 2023

Summary

Function: llSetForce( vector force, integer local );
0.0 Forced Delay
10.0 Energy

Applies force to the object (if the object is physical)

• vector force directional force
• integer local boolean, if TRUE force is treated as a local directional vector, if FALSE force is treated as a region directional vector

Continuous force. llApplyImpulse has instantaneous push.

Caveats

  • Only works in physics-enabled objects.Only works on physical objects and attachments (non-physical as well as physical). Used on an attachment, it will apply the force to the avatar.

Examples

//A simple rocket script. Launches object up when touched. 
//Sit on it for an interesting ride!
default
{
    touch_start(integer i)
    {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetForce(<0,0,0x7FFFFFFF>, 0);  //FLY!
    }
}

See Also

Functions

•  llSetForceAndTorque
•  llSetTorque
•  llApplyImpulse Instantaneous force

Deep Notes

Signature

function void llSetForce( vector force, integer local );