OsGetInertiaData
From OpenSimulator
(Difference between revisions)
(6 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
|delay=0 | |delay=0 | ||
|function_syntax=list osGetInertiaData() | |function_syntax=list osGetInertiaData() | ||
− | |||
|ossl_example=<source lang="lsl"> | |ossl_example=<source lang="lsl"> | ||
// Example of osGetInertiaData | // Example of osGetInertiaData | ||
Line 12: | Line 11: | ||
state_entry() | state_entry() | ||
{ | { | ||
− | + | llSetStatus(STATUS_PHYSICS, TRUE); | |
+ | llSetObjectName("osGetInertiaData"); | ||
+ | } | ||
+ | |||
+ | touch_start(integer n) | ||
+ | { | ||
+ | string text; | ||
+ | list buffer = osGetInertiaData(); | ||
+ | float mass = llList2Float(buffer, 0); | ||
+ | vector center = llList2Vector(buffer, 1); | ||
+ | vector Idiag = llList2Vector(buffer, 2); | ||
+ | vector Ioffdiag = llList2Vector(buffer, 3); | ||
+ | text += "\n• The total mass of the linkset is " + (string)mass; | ||
+ | text += "\n• The center of mass offset relative to root prim is " + (string)center; | ||
+ | text += "\n• Diagonal elements of inertia is " + (string)Idiag; | ||
+ | text += "\n• Off diagonal elements of inertia is " + (string)Ioffdiag; | ||
+ | llSay(PUBLIC_CHANNEL, text); | ||
} | } | ||
} | } | ||
</source> | </source> | ||
− | |description= | + | |description= returns a list:<br/> |
+ | [<br/> | ||
+ | float mass, // the total mass of the linkset<br/> | ||
+ | vector center, // the center of mass offset relative to root prim<br/> | ||
+ | vector Idiag, // diagonal elements of inertia<br/> | ||
+ | vector Ioffdiag // off diagonal elements of inertia<br/> | ||
+ | ] | ||
+ | |||
+ | mass maybe -1 if inertia data is invalid or not avaiable | ||
<div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid"> | <div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid"> | ||
'''Caution !''' Only supported by '''ubOde''' for now | '''Caution !''' Only supported by '''ubOde''' for now | ||
</div> | </div> | ||
|additional_info=This function was added in 0.9.0.1}} | |additional_info=This function was added in 0.9.0.1}} |
Revision as of 18:08, 20 February 2019
list osGetInertiaData()
| |
returns a list: [ mass maybe -1 if inertia data is invalid or not avaiable Caution ! Only supported by ubOde for now | |
Threat Level | This function does not do a threat level check |
Permissions | Use of this function is always allowed by default |
Extra Delay | 0 seconds |
Example(s) | |
// Example of osGetInertiaData default { state_entry() { llSetStatus(STATUS_PHYSICS, TRUE); llSetObjectName("osGetInertiaData"); } touch_start(integer n) { string text; list buffer = osGetInertiaData(); float mass = llList2Float(buffer, 0); vector center = llList2Vector(buffer, 1); vector Idiag = llList2Vector(buffer, 2); vector Ioffdiag = llList2Vector(buffer, 3); text += "\n• The total mass of the linkset is " + (string)mass; text += "\n• The center of mass offset relative to root prim is " + (string)center; text += "\n• Diagonal elements of inertia is " + (string)Idiag; text += "\n• Off diagonal elements of inertia is " + (string)Ioffdiag; llSay(PUBLIC_CHANNEL, text); } } | |
Notes | |
This function was added in 0.9.0.1 |