Difference between revisions of "NiAVObjectSetLocalRotation"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
imported>DragoonWraith
Line 2: Line 2:


'''Syntax'''
'''Syntax'''
  (bool:success) NiAVObjectSetLocalRotationTEMP float:a11 float:a12 float:a13 \
  (bool:success) NiAVObjectSetLocalRotationTEMP array_var:rotation short:nifID ''short:blockID''
                                              float:a21 float:a22 float:a23 \
                                              float:a31 float:a32 float:a33 short:nifID ''short:blockID''
   
   
  (bool:success) NiAVObjSetLocRotT float:a11 float:a12 float:a13 \
  (bool:success) NiAVObjSetLocRotT array_var:rotation short:nifID ''short:blockID''
                                  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 <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>.
Line 33: Line 29:
   NiAVObjectSetLocalRotation locRot nifID blockID
   NiAVObjectSetLocalRotation locRot nifID blockID
  loop
  loop
== Notes ==
* Because OBSE Plug-Ins cannot currently accept arrays as arguments, <tt>NiAVObjectSetLocalRotation</tt>, as it would properly exist, cannot be implemented. <tt>NiAVObjectSetLocalRotationTEMP</tt> is provided as an alternative; it will be deprecated in favor of <tt>NiAVObjectSetLocalRotation</tt> when OBSE adds the ability to take array arguments, but backwards compatibility will be maintained.
** Due to Wiki software limitations, the syntax for <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 ==
== See Also ==

Revision as of 12:16, 21 January 2011

This is a command from NifSE.

Syntax

(bool:success) NiAVObjectSetLocalRotationTEMP array_var:rotation short:nifID short:blockID

(bool:success) NiAVObjSetLocRotT 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.

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

  ; for clarity, using NiAVObjectSetLocalRotation.
  ; as noted below, this function does not yet exist,
  ; due to technical limitations in the OBSE Plugin API.
  NiAVObjectSetLocalRotation locRot nifID blockID
loop

See Also


External Links