Difference between revisions of "NiAVObjectGetLocalRotation"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
Line 22: Line 22:
   let blockID := *child
   let blockID := *child
   let locRot := NiAVObjectGetLocalRotation nifID blockID
   let locRot := NiAVObjectGetLocalRotation nifID blockID
   
  S
   let locRot := MatrixMultiply R locRot ; order matters
   let locRot := MatrixMultiply R locRot ; order matters
   
   

Revision as of 11:58, 21 December 2023

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
S
  let locRot := MatrixMultiply R locRot ; order matters

  NiAVObjectSetLocalRotation locRot nifID blockID
loop

See Also


External Links