Difference between revisions of "LlGetCenterOfMass"

From Second Life Wiki
Jump to navigation Jump to search
(making more explicit Dora's findings. I hope they are still accurate.)
Line 7: Line 7:
|Return_text=position of the object's center of mass in [[Viewer coordinate frames#Region|region coordinates]].
|Return_text=position of the object's center of mass in [[Viewer coordinate frames#Region|region coordinates]].
|func_footnote=If called from a child prim, the child's center of mass is returned instead (but still in region coordinates).
|func_footnote=If called from a child prim, the child's center of mass is returned instead (but still in region coordinates).
|spec
|spec=
The Center Of Mass for a prim is only computed when an object is physical. When a value is computed it is cached as a prim attribute. If the object is non-physical and there is a cached value, that is the value returned, otherwise [[llGetPos]]() is returned (this value is not cached).
|caveats=* Works in '''physical objects only'''.
|caveats=* Works in '''physical objects only'''.
** In non-physical objects Center Of Mass is not computed.
** The value is stored as a prim property and will only change when Center Of Mass is computed.
** Either the last computed ''value'' or llGetPos() is returned.
** If called from within a non-physical object it will return the stored {{HoverText|COM|Center Of Mass}} value or in the absence of a stored COM value it will return [[llGetPos]]().
** The ''value'' is stored as a prim property and will only change when Center Of Mass is computed.
*** It will not compute or recompute the COM if the object is non-physical.
*** The stored value can only be updated when the object is physical. Neither moving or changing the objects shape will update, invalidate or remove the stored COM value when it is non-physical.
|constants
|constants
|examples
|examples

Revision as of 23:37, 28 February 2012

Summary

Function: vector llGetCenterOfMass( );

Returns the vector position of the object's center of mass in region coordinates.

If called from a child prim, the child's center of mass is returned instead (but still in region coordinates).

Specification

The Center Of Mass for a prim is only computed when an object is physical. When a value is computed it is cached as a prim attribute. If the object is non-physical and there is a cached value, that is the value returned, otherwise llGetPos() is returned (this value is not cached).

Caveats

  • Works in physical objects only.
    • The value is stored as a prim property and will only change when Center Of Mass is computed.
    • If called from within a non-physical object it will return the stored COM value or in the absence of a stored COM value it will return llGetPos().
      • It will not compute or recompute the COM if the object is non-physical.
      • The stored value can only be updated when the object is physical. Neither moving or changing the objects shape will update, invalidate or remove the stored COM value when it is non-physical.
All Issues ~ Search JIRA for related Bugs

Examples

See Also

Functions

•  llGetPos
•  llGetGeometricCenter

Deep Notes

Search JIRA for related Issues

Signature

function vector llGetCenterOfMass();