[maxScript] Node Transform Properties


Node Transform Properties


Unless otherwise noted, the following transform properties are always interpreted with respect to the current working coordinate system as defined by the currently active coordsys context. The default coordsys isworld . The pos rotation , and scale properties of a node are aliases to the corresponding subcontroller for the node's transform controller. If the transform controller does not have one of these subcontrollers, accessing the corresponding node property will result in an "Unknown property" error message. For example, the LookAt controller does not have a Rotation subcontroller, and the IK controller does not have any subcontrollers. You can still access the transform values using the Matrix3 properties of the node's transform property, for example, objpos=obj.transform.translationpart .
   

<node>.transform: Matrix3
Can read/write to.
If written to, the Matrix3 value is decomposed into its position, rotation, and scale values. These values are stored in the respective position, rotation, and scale controllers, if those controllers exist and can be written to.
   

<node>.pos: Point3 --can use .position synonym throughout
<node>.pos.controller: Controller --can use .track synonym throughout
<node>.pos.isAnimated: Boolean, read-only --true if position is animated
<node>.pos.keys: MAXKeyArray
<node>.pos.track: Controller --synonym of .pos.controller
   

<node>.rotation: Quat
<node>.rotation.x_rotation: Float --X rotation of node
<node>.rotation.y_rotation: Float --Y rotation of node
<node>.rotation.z_rotation: Float --Z rotation of node
<node>.rotation.controller: Controller --can use .track synonym throughout
<node>.rotation.isAnimated: Boolean, read-only --true if rotation is animated
<node>.rotation.keys: MAXKeyArray
<node>.rotation.track: Controller --synonym of .rotation.controller
   

<node>.scale: Point3 -- fraction
<node>.scale.controller: Controller --can use .track synonym throughout
<node>.scale.isAnimated: Boolean, read-only --true if scale is animated
<node>.scale.keys: MAXKeyArray
<node>.scale.track: Controller --synonym of .scale.controller
   

<node>.dir: Point3 --local z-axis direction vector
Rotates node so that the node's Z axis points in the specified direction. The node is rotated around its Z axis such that the Y axis points as much as possible in the world -Z direction.
Getting and setting <node>.dir now respects the current coordinate system. Previously, this property was always in world coordinates.
   

<node>.max: Point3, read-only --max coordinates of node's bounding box
<node>.min: Point3, read-only --min coordinates of node's bounding box
<node>.center: Point3 --coordinates of center of node's bounding box
   

<node>.transform: Matrix3 --node's main transformation matrix

NOTE:
Rotation in the internal transformation matrices is left-handed in contradiction to the 3ds Max user interface and MAXScript. Take care when mixing rotation derived from these matrices and rotation used in rotation-related functions or from rotation properties.

<node>.pivot: Point3 -- node's pivot point position
   

<node>.objectOffsetPos: Point3
<node>.objectOffsetRot: Quat
<node>.objectOffsetScale: Point3
   
Node geometry's position, rotation, and scale offset from the pivot in world coordinates.

<node>.objectTransform: Matrix3, read-only
Node geometry's offset in world coordinates.


SCRIPT

--Setting a node's rotation relative to world space without
--messing with its position:
fn setNodeWorldRotation theNode theRot =
(
in coordsys (transmatrix theNode.transform.pos)
theNode.rotation = theRot
)
b = box isSelected:true 
setNodeWorldRotation $ (eulerangles 45 45 0)

0 コメント:

コメントを投稿