Difference between revisions of "LlGetMass"

From Second Life Wiki
Jump to navigation Jump to search
(whitespace is your friend (and makess the example easier to read!))
(Add notes regarding the use of Lindograms and Kilograms.)
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|func_id=109|func_sleep=0.0|func_energy=10.0
|func_id=109|func_sleep=0.0|func_energy=10.0|func=llGetMass|return_type=float
|func=llGetMass|return_type=float
|func_footnote
|func_footnote
|func_desc
|func_desc
|return_text=that is the mass of object that script is attached to.
|return_text=that is the mass of object (in [[#Lindograms|Lindograms]]) that script is attached to.
|func_footnote=
|spec
|spec
|caveats=*Attachments do not effect an avatar's mass, only certain Appearance settings.
|caveats=*The mass reported by this function is in [[#Lindograms|Lindograms]], which function the same as Kilograms within the bounds of Second Life, but not elsewhere. (See below)
*Attachments do not effect an avatar's mass, only certain Appearance settings.
**Avatar mass is reported to either be unexpectedly low (when measured using [[llGetMass]]) or unexpectedly high (when measured using [[llGetMassMKS]]). This is likely due to the weight being calculated based on a fixed value, with a modifier for height. The fixed value being used is incorrect, likely due to an incorrect density value being used.
|constants
|constants
|examples=<lsl>//A way of making a constant force that returns the same speed visually whatever the object is
|examples=<syntaxhighlight lang="lsl2">//A way of making a constant force that returns the same speed visually whatever the object is
default
default
{
{
     touch_start()
     touch_start()
     {
     {
         llApplyImpulse(<0.0, 0.0, 5.0> * llGetMass(), FALSE); // This would fire the object up at the same m/s whatever the size (or difference!)
         llApplyImpulse(<0.0, 0.0, 5.0> * llGetMass(), FALSE);
        // This fires the object up at the same m/s whatever the size (or difference!)
     }
     }
}//Written by El Taka</lsl>
}//Written by El Taka</syntaxhighlight>
 
|helpers
|helpers
|also_functions=
|also_functions=
{{LSL DefineRow||[[llGetObjectMass]]|Gets the object mass.}}
{{LSL DefineRow||[[llGetObjectMass]]|Gets the object mass (in Lindograms)}}
{{LSL DefineRow||[[llGetForce]]|Gets the objects force}}
{{LSL DefineRow||[[llGetForce]]|Gets the objects force}}
{{LSL DefineRow||[[llGetOmega]]|}}
{{LSL DefineRow||[[llGetOmega]]|}}
Line 25: Line 27:
{{LSL DefineRow||[[llGetTorque]]|}}
{{LSL DefineRow||[[llGetTorque]]|}}
{{LSL DefineRow||[[llGetAccel]]|}}
{{LSL DefineRow||[[llGetAccel]]|}}
{{LSL DefineRow||[[llGetMassMKS]]|Get the mass of an object (in Kilograms)}}
|also_events
|also_events
|also_tests
|also_tests
Line 36: Line 39:
|cat4
|cat4
}}
}}
==Lindograms==
"Lindograms" is the name of the primary unit of mass used in Second Life.
While Second Life primarily makes use of the [https://en.wikipedia.org/wiki/International_System_of_Units SI system of units], mass seems to be an exception.
Some speculate that Lindograms are intended to be Kilograms, but a mistake was made when factoring object density; causing the mass value returned to be 100* less than the actual kilogram value. As a result, some new functions were implemented (such as [[llGetMassMKS]]) which report the correct kilogram weight of an object.
Functionally speaking, Lindograms can be used in the same way Kilograms are used'''*''', however only within the bounds of Second Life. Trying to export mass values from Second Life will often run into issues, caused by the use of Lindograms as a base unit of measurement.
'''From a technical point-of-view, a Lindogram is equivalent to a [https://en.wikipedia.org/wiki/Quintal Metric Quintal], however it is not treated as such.'''
'''*''' With exception to some functions, such as [[llSetPhysicsMaterial]], which use Kilograms, not Lindograms. [[llGetMassMKS]] returns a Kilogram value, not a Lindogram value.

Revision as of 12:21, 8 July 2022

Summary

Function: float llGetMass( );

Returns a float that is the mass of object (in Lindograms) that script is attached to.

Caveats

  • The mass reported by this function is in Lindograms, which function the same as Kilograms within the bounds of Second Life, but not elsewhere. (See below)
  • Attachments do not effect an avatar's mass, only certain Appearance settings.
    • Avatar mass is reported to either be unexpectedly low (when measured using llGetMass) or unexpectedly high (when measured using llGetMassMKS). This is likely due to the weight being calculated based on a fixed value, with a modifier for height. The fixed value being used is incorrect, likely due to an incorrect density value being used.
All Issues ~ Search JIRA for related Bugs

Examples

//A way of making a constant force that returns the same speed visually whatever the object is
default
{
    touch_start()
    {
        llApplyImpulse(<0.0, 0.0, 5.0> * llGetMass(), FALSE);
        // This fires the object up at the same m/s whatever the size (or difference!)
    }
}//Written by El Taka

See Also

Functions

•  llGetObjectMass Gets the object mass (in Lindograms)
•  llGetForce Gets the objects force
•  llGetOmega
•  llGetVel
•  llGetTorque
•  llGetAccel
•  llGetMassMKS Get the mass of an object (in Kilograms)

Deep Notes

Search JIRA for related Issues

Signature

function float llGetMass();

Lindograms

"Lindograms" is the name of the primary unit of mass used in Second Life.

While Second Life primarily makes use of the SI system of units, mass seems to be an exception.

Some speculate that Lindograms are intended to be Kilograms, but a mistake was made when factoring object density; causing the mass value returned to be 100* less than the actual kilogram value. As a result, some new functions were implemented (such as llGetMassMKS) which report the correct kilogram weight of an object.

Functionally speaking, Lindograms can be used in the same way Kilograms are used*, however only within the bounds of Second Life. Trying to export mass values from Second Life will often run into issues, caused by the use of Lindograms as a base unit of measurement.

From a technical point-of-view, a Lindogram is equivalent to a Metric Quintal, however it is not treated as such.

* With exception to some functions, such as llSetPhysicsMaterial, which use Kilograms, not Lindograms. llGetMassMKS returns a Kilogram value, not a Lindogram value.