Difference between revisions of "PRIM POSITION"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 6: Line 6:
{{LSL_Function/position|positionset|region=*|local=*}}
{{LSL_Function/position|positionset|region=*|local=*}}


{{#vardefine:caveats-get|* '''{{LSL Param|positionget|position}}''' is always in [[Viewer_coordinate_frames#region|region coordinates]], even if the prim is a child or the root prim of an [[attachment]].}}
{{#vardefine:caveats-get|* {{LSLP|positionget|position}} is always in [[Viewer_coordinate_frames#region|region coordinates]], even if the prim is a child or the root prim of an [[attachment]].}}


{{#vardefine:caveats-set|{{#ifeq:{{{1|}}}|set|**|*}} Depending upon the situation '''{{LSL Param|positionset|position}}''' may need to be in [[Viewer_coordinate_frames#local|local coordinates]] or [[Viewer_coordinate_frames#region|region coordinates]], See [[llSetPos#Specification]] for details.
{{#vardefine:caveats-set|{{#ifeq:{{{1|}}}|set|**|*}} Depending upon the situation {{LSLP|positionset|position}} may need to be in [[Viewer_coordinate_frames#local|local coordinates]] or [[Viewer_coordinate_frames#region|region coordinates]], See [[llSetPos#Specification]] for details.
{{#ifeq:{{{1|}}}|set|***|**}}It is usually not a good idea to combine [[PRIM_POSITION]] with [[LINK_SET]]. The root will treat the coordinates as world or attachment, while the children will treat them as local, yielding inconsistent results or failure. If you want to move the object as a unit, use [[LINK_ROOT]] instead.
{{#ifeq:{{{1|}}}|set|***|**}}It is usually not a good idea to combine [[PRIM_POSITION]] with [[LINK_SET]]. The root will treat the coordinates as world or attachment, while the children will treat them as local, yielding inconsistent results or failure. If you want to move the object as a unit, use [[LINK_ROOT]] instead.
{{#ifeq:{{{1|}}}|set|**|*}} The range the prim can move is limited if it is an unattached root prim. The distance is capped to 10m per {{#var:position_const}} call. See [[WarpPos]]. This is a very special case. Do not rely on rule duplication of other flags - the results are undefined, and things ''will'' break in the future.
{{#ifeq:{{{1|}}}|set|**|*}} The range the prim can move is limited if it is an unattached root prim. The distance is capped to 10m per {{#var:position_const}} call. See [[WarpPos]]. This is a very special case. Do not rely on rule duplication of other flags - the results are undefined, and things ''will'' break in the future.
Line 15: Line 15:
{{#ifeq:{{{1|}}}|set|***|**}} Moving an avatar does not move the prim they sat upon.
{{#ifeq:{{{1|}}}|set|***|**}} Moving an avatar does not move the prim they sat upon.
{{#ifeq:{{{1|}}}|set|***|**}} Sit-target coordinates do not easily map to prim coordinates, use [[llSitTarget#Useful_Snippets|UpdateSitTarget]].
{{#ifeq:{{{1|}}}|set|***|**}} Sit-target coordinates do not easily map to prim coordinates, use [[llSitTarget#Useful_Snippets|UpdateSitTarget]].
{{#ifeq:{{{1|}}}|set|***|**}} If '''{{LSL Param|positionset|position}}''' is greater than 54 meters away from the center, the repositioning will silently fail.}}
{{#ifeq:{{{1|}}}|set|***|**}} If {{LSLP|positionset|position}} is greater than 54 meters away from the center, the repositioning will silently fail.}}


{{#switch:{{{1|}}}|set={{#vardefine:caveats|{{#var:caveats}}
{{#switch:{{{1|}}}|set={{#vardefine:caveats|{{#var:caveats}}

Revision as of 12:01, 8 June 2012

Description

Constant: integer PRIM_POSITION = 6;

The integer constant PRIM_POSITION has the value 6

PRIM_POSITION is used to get or set the prim's position.

llSetPrimitiveParams

llSetPrimitiveParams([ ..., PRIM_POSITION, vector position, ... ]);
• vector position position in region or local coordinates depending upon the situation

The same syntax applies to llSetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast but with an additional prefixed link parameter in the function call.

Caveats

  • Depending upon the situation position may need to be in local coordinates or region coordinates, See llSetPos#Specification for details.
    • It is usually not a good idea to combine PRIM_POSITION with LINK_SET. The root will treat the coordinates as world or attachment, while the children will treat them as local, yielding inconsistent results or failure. If you want to move the object as a unit, use LINK_ROOT instead.
  • The range the prim can move is limited if it is an unattached root prim. The distance is capped to 10m per PRIM_POSITION call. See WarpPos. This is a very special case. Do not rely on rule duplication of other flags - the results are undefined, and things will break in the future.
  • Moving avatars with PRIM_POSITION
    • Moving the prim the avatar sat upon does not move the avatar.
    • Moving an avatar does not move the prim they sat upon.
    • Sit-target coordinates do not easily map to prim coordinates, use UpdateSitTarget.
    • If position is greater than 54 meters away from the center, the repositioning will silently fail.
All Issues ~ Search JIRA for related Bugs

Avatars

Avatars sitting on the object can be moved with llSetLinkPrimitiveParams and PRIM_POSITION. This was originally a mis-feature but according to Andrew Linden LL has decided to support it.

Examples

The below example moves an avatar to x,y,z without moving the prim they are sitting on. If x,y,z is more than 54 meters away the call will silently fail. Remember x,y,z is in object relative coordinates just like any other linked prim in a set.

Avatars are always the last prims in the set, so llGetNumberOfPrims can be used for a single avatar sitting on a vehicle.

Example: <lsl>llSetLinkPrimitiveParams(llGetNumberOfPrims(), [PRIM_POSITION, <x,y,z>]);</lsl>

llGetPrimitiveParams

llGetPrimitiveParams([ ..., PRIM_POSITION, ... ]);

Returns the list [ vector position ]

• vector position position in region coordinates

The same syntax applies to llGetLinkPrimitiveParams, but with an additional prefixed link parameter in the function call.

Caveats

All Issues ~ Search JIRA for related Bugs

Related Articles

Constants

•  PRIM_ROTATION

Functions

•  llGetPrimitiveParams
•  llSetPrimitiveParams
•  llSetLinkPrimitiveParams
•  llGetPos
•  llSetPos
•  llGetLocalPos
•  llGetRootPosition
•  llGetObjectDetails

Articles

•  warpPos

Deep Notes

Search JIRA for related Issues

Signature

integer PRIM_POSITION = 6;