Difference between revisions of "NiAVObjectSetLocalRotation"

Jump to navigation Jump to search
784 bytes added ,  14:51, 29 August 2010
no edit summary
imported>DragoonWraith
imported>DragoonWraith
 
'''Syntax'''
(bool:success) NifSetNthChildLocalRotationTEMPNiAVObjectSetLocalRotationTEMP float:a11 float:a12 float:a13 \
float:a21 float:a22 float:a23 \
float:a31 float:a32 float:a33 short:ChildIDnifID ''short:NifIDblockID''
(bool:success) NiAVObjSetLocRotT float:a11 float:a12 float:a13 \
float:a21 float:a22 float:a23 \
float:a31 float:a32 float:a33 short:nifID ''short:blockID''
 
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>.
Sets the local rotation of the specified Child of the root node.
 
== Example ==
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.
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.
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
 
== Notes ==
* Because OBSE Plug-Ins cannot currently accept arrays as arguments, this<tt>NiAVObjectSetLocalRotation</tt>, functionas takesit 9would floatsproperly insteadexist, ofcannot onebe 3x3 matrix of floatsimplemented. OBSE v1900<tt>NiAVObjectSetLocalRotationTEMP</tt> is expectedprovided toas enablean thealternative; acceptance of arrays, in which case this functionit will be deprecated in favor of the<tt>NiAVObjectSetLocalRotation</tt> versionwhen thatOBSE acceptsadds the matrix.ability Backwardsto take array arguments, but backwards compatibility ''will'' be maintained however.
** Due to Wiki software limitations, the syntax sectionfor <tt>NiAVObjectSetLocalRotationTEMP</tt> 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.
 
== See Also ==
* [[NiAVObjectGetLocalRotation]]
* [[NifGetNthChildLocalRotation]]
 
 
* [[NiAVObjectSetLocalTransform]]
* [[NifSetNthChildLocalTransformTEMP]]
* [[NiAVObjectSetLocalTranslation]]
* [[NifSetNthChildLocalTranslationTEMP]]
* [[NiAVObjectSetLocalScale]]
* [[NifSetNthChildLocalScale]]
 
== External Links ==
* [http://en.wikipedia.org/wiki/Rotation_representation#Rotation_matrix Wikipedia: Rotation Matrices]
 
[[Category:NifSE|SetNthChildRotationAVObjectSetLocalRotation]]
[[Category:NifSE (ChildrenNiAVObject)|SetNthChildRotationSetLocalRotation]]

Navigation menu