1,482
edits
(Added a new workaround for the player's eyes being stuck shut that I discovered while making my mod.) |
m (Convert source tags to syntaxhighlight) |
||
| Line 7: | Line 7: | ||
== Syntax == | == Syntax == | ||
< | <syntaxhighlight lang="papyrus"> | ||
Function MoveTo(ObjectReference akTarget, float afXOffset = 0.0, | Function MoveTo(ObjectReference akTarget, float afXOffset = 0.0, | ||
float afYOffset = 0.0, float afZOffset = 0.0, bool abMatchRotation = true) native | float afYOffset = 0.0, float afZOffset = 0.0, bool abMatchRotation = true) native | ||
</ | </syntaxhighlight> | ||
== Parameters == | == Parameters == | ||
| Line 27: | Line 27: | ||
== Examples == | == Examples == | ||
< | <syntaxhighlight lang="papyrus"> | ||
; Move Bob to his house, designated by a marker | ; Move Bob to his house, designated by a marker | ||
Bob.MoveTo(BobsHouseMarker) | Bob.MoveTo(BobsHouseMarker) | ||
</ | </syntaxhighlight> | ||
<br/> | <br/> | ||
< | <syntaxhighlight lang="papyrus"> | ||
; Move Bob to his house, but don't match the rotation of the marker | ; Move Bob to his house, but don't match the rotation of the marker | ||
Bob.MoveTo(BobsHouseMarker, abMatchRotation = false) | Bob.MoveTo(BobsHouseMarker, abMatchRotation = false) | ||
</ | </syntaxhighlight> | ||
<br/> | <br/> | ||
< | <syntaxhighlight lang="papyrus"> | ||
; Moves a portal 120 units in front of the player, 35 units under their height | ; Moves a portal 120 units in front of the player, 35 units under their height | ||
Actor PlayerRef = Game.GetPlayer() | Actor PlayerRef = Game.GetPlayer() | ||
Portal.MoveTo(PlayerRef, 120.0 * Math.Sin(PlayerRef.GetAngleZ()), 120.0 * Math.Cos(PlayerRef.GetAngleZ()), PlayerRef.GetHeight() - 35.0) | Portal.MoveTo(PlayerRef, 120.0 * Math.Sin(PlayerRef.GetAngleZ()), 120.0 * Math.Cos(PlayerRef.GetAngleZ()), PlayerRef.GetHeight() - 35.0) | ||
</ | </syntaxhighlight> | ||
== Notes == | == Notes == | ||
| Line 52: | Line 52: | ||
* MoveTo can cause undesirable results when moving an object to another actor, whose X and Y rotation angles are relative to that actor's looking angle, not their rotation relative to the world. Furthermore, as with [[SetPosition - ObjectReference|SetPosition]], MoveTo doesn't take uneven terrain into account. | * MoveTo can cause undesirable results when moving an object to another actor, whose X and Y rotation angles are relative to that actor's looking angle, not their rotation relative to the world. Furthermore, as with [[SetPosition - ObjectReference|SetPosition]], MoveTo doesn't take uneven terrain into account. | ||
**In order to "straighten" or flatten an object's rotation, set the abMatchRotation parameter to False, or call [[SetAngle - ObjectReference|SetAngle]] similar to the following: | **In order to "straighten" or flatten an object's rotation, set the abMatchRotation parameter to False, or call [[SetAngle - ObjectReference|SetAngle]] similar to the following: | ||
< | <syntaxhighlight lang="papyrus"> | ||
myObject.MoveTo(Game.GetPlayer()) ;Or, whatever the target of the MoveTo() is | myObject.MoveTo(Game.GetPlayer()) ;Or, whatever the target of the MoveTo() is | ||
myObject.SetAngle(0.0, 0.0, 0.0) | myObject.SetAngle(0.0, 0.0, 0.0) | ||
</ | </syntaxhighlight> | ||
* Actors moved with this function are always rotated correctly relative to the world. | * Actors moved with this function are always rotated correctly relative to the world. | ||