NiAVObjectGetLocalRotation

From the Oblivion ConstructionSet Wiki
Revision as of 11:58, 21 December 2023 by 173.17.114.221 (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is a command from NifSE.

Syntax

(matrix:localRotation) NiAVObjectGetLocalRotation short:nifID short:blockID
(matrix:localRotation) NiAVObjGetLocRot short:nifID short:blockID

Returns the matrix of the local rotation of the specified NiAVObject-derived block. The default value of blockID is 0, referring to the root NiNode, which is derived from NiAVObject. Therefore, this function can be used with the default argument when referring to the root node.

The matrix is a 3x3 array of floats, and is compatible with OBSE's linear algebra functions.

Example

This script will rotate each of the root's children, which are NiAVObject blocks, 180° about the X axis. This will effectively flip the NIF upside-down.

array_var R
array_var children
array_var child
short nifID
short blockID
...
let R := GenerateRotationMatrix X 180
let children := NiNodeGetChildren nifID
foreach child <- children
  let blockID := *child
  let locRot := NiAVObjectGetLocalRotation nifID blockID

  let locRot := MatrixMultiply R locRot ; order matters

  NiAVObjectSetLocalRotation locRot nifID blockID
loop

See Also


External Links