Difference between revisions of "MoveTo - ObjectReference"

Jump to navigation Jump to search
54 bytes added ,  12:31, 22 February 2015
Cleaned up grammar; fixed code example.
imported>Terra Nova2
(→‎Notes: added code for forcing objects to appear the correct way in the world with moveto.)
imported>Chesko
(Cleaned up grammar; fixed code example.)
Line 48: Line 48:
* Making an actor MoveTo() a furniture reference will make the actor immediately assume the position of "using" that furniture, without playing the furniture entrance animation. Example: PlayerRef.MoveTo(BedReference) will make the player lie down on the bed reference (without playing the bed entrance animation).
* Making an actor MoveTo() a furniture reference will make the actor immediately assume the position of "using" that furniture, without playing the furniture entrance animation. Example: PlayerRef.MoveTo(BedReference) will make the player lie down on the bed reference (without playing the bed entrance animation).


* MoveTo can sometimes cause some pretty interesting, yet undesirable results when moving objects, such as chests, often appear in the world in really odd angles. Furthermore, as with [[SetPosition - ObjectReference|SetPosition]], MoveTo doesn't take in account for uneven terrain.
* 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 out an object is to call [[SetAngle - ObjectReference|SetAngle]], using the following code:
**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:
<source lang="papyrus">
<source lang="papyrus">
ObjectReference TempRef = myObject.MoveTo(Game.GetPlayer(), 0.0, 0.0, 0.0)
myObject.MoveTo(Game.GetPlayer()) ;Or, whatever the target of the MoveTo() is
TempRef.SetAngle(0, Game.GetPlayer().GetAngleY(), Game.GetPlayer().GetAngleZ())
myObject.SetAngle(0.0, 0.0, 0.0)
</source>
</source>
**This is not required for actors being moved with this function.
* Actors moved with this function are always rotated correctly relative to the world.


== Bugs ==
== Bugs ==
Anonymous user

Navigation menu