Difference between revisions of "NiAVObjectSetLocalRotation"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
Tag: Manual revert
 
(8 intermediate revisions by 2 users not shown)
Line 2: Line 2:


'''Syntax'''
'''Syntax'''
  (bool:success) NifSetNthChildLocalRotationTEMP float:a11 float:a12 float:a13 \
  (bool:success) NiAVObjectSetLocalRotation array_var:rotation short:nifID ''short:blockID''
                                                float:a21 float:a22 float:a23 \
(bool:success) NiAVObjSetLocRot array_var:rotation short:nifID ''short:blockID''
                                                float:a31 float:a32 float:a33 short:ChildID short:NifID


Sets the local rotation of the specified Child of the root node.
Sets the local rotation of the specified <tt>NiAVObject</tt>-derived block. Since <tt>blockID</tt> defaults to 0, the NIF's root <tt>NiNode</tt>, and <tt>NiNode</tt> is derived from <tt>NiAVObject</tt>, this function will change the local rotation of the NIF's root if called with no explicit <tt>blockID</tt>.
 
The passed <tt>array_var</tt> must be a 3×3 [[GenerateRotationMatrix|rotation matrix]]


== 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
== Notes ==
array_var children
* Because OBSE Plug-Ins cannot currently accept arrays as arguments, this function takes 9 floats instead of one 3x3 matrix of floats. OBSE v1900 is expected to enable the acceptance of arrays, in which case this function will be deprecated in favor of the version that accepts the matrix. Backwards compatibility ''will'' be maintained however.
array_var child
* Due to Wiki software limitations, the syntax section cannot be written on one line. Furthermore, it would be hideous to attempt to read that way in any case. However, the CS '''requires''' that all 11 arguments appear on a single line.
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 ==
* [[NifGetNthChildLocalRotation]]
* [[NiAVObjectGetLocalRotation]]




* [[NifSetNthChildLocalTransformTEMP]]
* [[NiAVObjectSetLocalTransform]]
* [[NifSetNthChildLocalTranslationTEMP]]
* [[NiAVObjectSetLocalTranslation]]
* [[NifSetNthChildLocalScale]]
* [[NiAVObjectSetLocalScale]]


== 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|SetNthChildRotation]]
[[Category:NifSE|AVObjectSetLocalRotation]]
[[Category:NifSE (Children)|SetNthChildRotation]]
[[Category:NifSE (NiAVObject)|SetLocalRotation]]

Latest revision as of 12:19, 21 December 2023

This is a command from NifSE.

Syntax

(bool:success) NiAVObjectSetLocalRotation array_var:rotation short:nifID short:blockID
(bool:success) NiAVObjSetLocRot array_var:rotation short:nifID short:blockID

Sets the local rotation of the specified NiAVObject-derived block. Since blockID defaults to 0, the NIF's root NiNode, and NiNode is derived from NiAVObject, this function will change the local rotation of the NIF's root if called with no explicit blockID.

The passed array_var must be a 3×3 rotation matrix

Example[edit | edit source]

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[edit | edit source]


External Links[edit | edit source]