Difference between revisions of "NiAVObjectGetLocalRotation"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
m (NifGetNthChildLocalRotation moved to NiAVObjectGetLocalRotation: new name for function as of alpha 5.)
imported>DragoonWraith
Line 2: Line 2:


'''Syntax'''
'''Syntax'''
  (matrix:LocalRotation) NifGetNthChildLocalRotation short:ChildID short:NifID
  (matrix:localRotation) NiAVObjectGetLocalRotation short:nifID ''short:blockID''
(matrix:localRotation) NiAVObjGetLocRot short:nifID ''short:blockID''


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


The matrix is a 3x3 array of floats.
The matrix is a 3x3 array of floats, and is compatible with [[:Category:Linear Algebra Functions (OBSE)|OBSE's linear algebra functions]].


== Example ==
== Example ==
The '<tt>DWnifSEexRotations.esp</tt>' file [http://code.google.com/p/nifse/downloads/list here] contains scripts which create [http://en.wikipedia.org/wiki/Rotation_matrix#Three_dimensions rotation matrices] about each XYZ axis, and applies them to the local rotation of a mesh, demonstrating how this function might be used.
This script will rotate each of the root's children, which are <tt>NiAVObject</tt> 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 ==
== See Also ==
* [[NifSetNthChildLocalRotationTEMP]]
* [[NiAVObjectSetLocalRotation]]




* [[NifGetNthChildLocalTransform]]
* [[NiAVObjectGetLocalTransform]]
* [[NifGetNthChildLocalTranslation]]
* [[NiAVObjectGetLocalTranslation]]
* [[NifGetNthChildLocalScale]]
* [[NiAVObjectGetLocalScale]]


== External Links ==
== External Links ==
* [http://en.wikipedia.org/wiki/Rotation_representation#Rotation_matrix Wikipedia: Rotation Matrices]
* [http://en.wikipedia.org/wiki/Rotation_representation#Rotation_matrix Wikipedia: Rotation Matrices]


[[Category:NifSE|GetNthChildLocalRotation]]
[[Category:NifSE|AVObjectGetLocalRotation]]
[[Category:NifSE (Children)|GetNthChildLocalRotation]]
[[Category:NifSE (NiAvObject)|GetLocalRotation]]

Revision as of 21:21, 28 August 2010

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