SetAngle - ObjectReference

From the CreationKit Wiki
Jump to navigation Jump to search

Member of: ObjectReference Script

Sets the object's current rotation in the world.

Syntax[edit | edit source]

Function SetAngle(float afXAngle, float afYAngle, float afZAngle) native

Parameters[edit | edit source]

  • afXAngle: Rotation around the X axis, in degrees.
  • afYAngle: Rotation around the Y axis, in degrees.
  • afZAngle: Rotation around the Z axis, in degrees.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Set the statue to be facing the other way (180 around Z)
; Z is the compass direction
StatueProperty.SetAngle(0.0, 0.0, 180.0)

Notes[edit | edit source]

  • When rotating an object, it is important to know the order in which the rotation angles are applied. The Z-axis rotation (yaw: north/south/east/west) is applied first, followed by the Y-axis (roll: tilt) and finally the X-axis (pitch: forward/backward).
  • Skyrim appears to use extrinsic left-handed XYZ angles.
    • Extrinsic means that world-relative axes are used. Rotating an object along one axis won't change its other axes.
    • Left-handed means that objects rotate clockwise as angles increase, as opposed to right-handed systems that use counter-clockwise rotations.
  • If called on an object whose 3D is not currently loaded (even if the reference is persistent -- which of course it would be if you have an ObjectReference variable pointing at it with which to call this function), this will fail. There will be no error in the script log, but the angles will not actually be changed.

See Also[edit | edit source]