SetPosition - ObjectReference: Difference between revisions

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Catwheezle
(→‎Notes: added forcegreet.)
m (Convert source tags to syntaxhighlight)
 
(5 intermediate revisions by 4 users not shown)
Line 7: Line 7:


== Syntax ==
== Syntax ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
Function SetPosition(float afX, float afY, float afZ) native
Function SetPosition(float afX, float afY, float afZ) native
</source>
</syntaxhighlight>


== Parameters ==
== Parameters ==
Line 20: Line 20:


== Examples ==
== Examples ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Set the statue to be at the center of the world
; Set the statue to be at the center of the world
StatueProperty.SetPosition(0.0, 0.0, 0.0)
StatueProperty.SetPosition(0.0, 0.0, 0.0)
</source>
</syntaxhighlight>


== Notes==
== Notes==
* SetPosition() should be avoided for placing other actors in sight of the player, as they will suddenly appear in an unrealistic way. Instead, consider placing them nearby but out of sight, and making them approach the player themselves, using [[PathToReference_-_Actor|PathToReference]] or [[ForceGreet (Procedure)|ForceGreet]].
* SetPosition() should be avoided for placing other actors in sight of the player, as they will suddenly appear in an unrealistic way. Instead, consider placing them nearby but out of sight, and making them approach the player themselves, using [[PathToReference_-_Actor|PathToReference]] or [[ForceGreet (Procedure)|ForceGreet]].
* All movement functions can cause [[SetMotionType - ObjectReference#Bugs|major issues]] when used on a reference that has had a [[SetMotionType - ObjectReference|motion type override]] applied.


== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[GetPositionX - ObjectReference]]
*[[GetPositionX - ObjectReference]]
*[[GetPositionY - ObjectReference]]
*[[GetPositionY - ObjectReference]]
*[[GetPositionZ - ObjectReference]]
*[[GetPositionZ - ObjectReference]]
*[[PlaceAtMe - ObjectReference]]
*[[MoveTo - ObjectReference]]
*[[MoveToInteractionLocation - ObjectReference]]
*[[MoveToMyEditorLocation - ObjectReference]]
*[[MoveToMyEditorLocation - ObjectReference]]
*[[MoveToInteractionLocation - ObjectReference]]
*[[ObjectReference Script]]
*[[PathToReference - Actor]]
*[[PathToReference - Actor]]
*[[MoveTo - ObjectReference]]
*[[Spatial functions and snippets]]
*[[Unit]]

Latest revision as of 20:21, 5 September 2026

Member of: ObjectReference Script

Sets the object's current position in the world.

Syntax[edit | edit source]

Function SetPosition(float afX, float afY, float afZ) native

Parameters[edit | edit source]

  • afX: Position along the X axis.
  • afY: Position along the Y axis.
  • afZ: Position along the Z axis.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Set the statue to be at the center of the world
StatueProperty.SetPosition(0.0, 0.0, 0.0)

Notes[edit | edit source]

  • SetPosition() should be avoided for placing other actors in sight of the player, as they will suddenly appear in an unrealistic way. Instead, consider placing them nearby but out of sight, and making them approach the player themselves, using PathToReference or ForceGreet.

See Also[edit | edit source]