OsGetInertiaData

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Added permissions and delay information)
(Script improvement)
 
(10 intermediate revisions by 3 users not shown)
Line 3: Line 3:
 
|permissions=true
 
|permissions=true
 
|delay=0
 
|delay=0
|function_syntax=
+
|function_syntax=list osGetInertiaData()
|csharp_syntax=
+
|description=<div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid">
 +
'''Caution !''' Only supported by '''ubOde''' for now.</div>
 +
This fonction retrun a list of inertia data.
 +
[
 +
    float mass,    // the total mass of the linkset
 +
    vector center,  // the center of mass offset relative to root prim
 +
    vector Idiag,  // diagonal elements of inertia
 +
    vector Ioffdiag // off diagonal elements of inertia
 +
]
 +
Mass maybe -1 if inertia data is invalid or not avaiable
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
// Example of osGetInertiaData
+
//
 +
// osGetInertiaData Script Exemple
 +
// Author: djphil
 +
//
  
 
default
 
default
Line 12: Line 24:
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         ...
+
         llSay(PUBLIC_CHANNEL, "Touch to see osGetInertiaData usage.");
 +
        llSetStatus(STATUS_PHYSICS, TRUE);
 +
    }
 +
 
 +
    touch_start(integer number)
 +
    {
 +
        list buffer = osGetInertiaData();
 +
        float mass = llList2Float(buffer, 0);
 +
        vector center = llList2Vector(buffer, 1);
 +
        vector Idiag = llList2Vector(buffer, 2);
 +
        vector Ioffdiag = llList2Vector(buffer, 3);
 +
 
 +
        if (mass == -1)
 +
        {
 +
            llSay(PUBLIC_CHANNEL, "The inertia data is invalid or not avaiable ...");
 +
        }
 +
 
 +
        else
 +
        {
 +
            string text;
 +
            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=...
+
|additional_info=This function was added in 0.9.0.1}}
<div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid">
+
'''Caution !''' Only supported by '''ubOde''' for now
+
</div>
+
|
+
}}
+

Latest revision as of 12:39, 2 December 2020

list osGetInertiaData()
Caution ! Only supported by ubOde for now.

This fonction retrun a list of inertia data.

[
    float mass,     // the total mass of the linkset
    vector center,  // the center of mass offset relative to root prim
    vector Idiag,   // diagonal elements of inertia
    vector Ioffdiag // off diagonal elements of inertia
]

Mass maybe -1 if inertia data is invalid or not avaiable

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)
//
// osGetInertiaData Script Exemple
// Author: djphil
//
 
default
{
    state_entry()
    {
        llSay(PUBLIC_CHANNEL, "Touch to see osGetInertiaData usage.");
        llSetStatus(STATUS_PHYSICS, TRUE);
    }
 
    touch_start(integer number)
    {
        list buffer = osGetInertiaData();
        float mass = llList2Float(buffer, 0);
        vector center = llList2Vector(buffer, 1);
        vector Idiag = llList2Vector(buffer, 2);
        vector Ioffdiag = llList2Vector(buffer, 3);
 
        if (mass == -1)
        {
            llSay(PUBLIC_CHANNEL, "The inertia data is invalid or not avaiable ...");
        }
 
        else
        {
            string text;
            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


Personal tools
General
About This Wiki