FxObject3D ​
This module contains functions for nodes that inherit from Object3D.
Load ​
FxObject3D = require "FxObject3D";Functions ​
| Function | Description |
|---|---|
| Freeze (NodeID, Translate, Rotate, Scale) | Freezes the transformations of a node. |
| Merge (NodeID) | Merges a node and its child nodes into a single node. |
| Parent (NodeID, NewParentID) | Parents a node to a new parent and preserves its world transformations. |
| Translate (NodeID, X, Y, Z, InLocalSpace) | Offsets the position of a node. |
| Unfreeze (NodeID, Translate, Rotate, Scale) | Unfreezes the transformations of a node. |
Freeze (NodeID, Translate, Rotate, Scale) ​
This function freezes the transformations of the specified node. For example, freezing the translation sets an internal offset so that the live translation value (which is the sum of the actual translation value and the offset) is zero, making it easier to create animations. Live transformations are the ones displayed in the Inspector of the user interface. Note that you can get and set both actual and live transformations, but not the internal offset. Use Unfreeze to reset the offsets.
Parameters ​
- NodeID: The NodeID to identify the Object3D nodes to freeze
- Translate: Whether to freeze translation
- Rotate: Whether to freeze rotatation
- Scale: Whether to freeze scaling
Errors ​
Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND
Since ​
Version 1.0
Example ​
-- set translate value
FxNode.Set3f("layer1", "translate" 10.0, 4.0, 3.0);
-- freeze translate
FxObject3D.Freeze("layer1", true, false, false);
-- get values
x y z = FxNode.Get3f("layer1", "translate") -- returns 10.0, 4.0, 3.0
x y z = FxNode.Get3f("layer1", "livetranslate") -- returns 0.0, 0.0, 0.0
-- translate
FxObject3D.Translate("layer1", 10.0, 10.0, 10.0)
-- get values
x y z = FxNode.Get3f("layer1", "translate") -- returns 20.0, 24.0, 23.0
x y z = FxNode.Get3f("layer1", "livetranslate") -- returns 10.0, 10.0, 10.0Merge (NodeID) ​
This function merges the specified node and all its child nodes into a single VoxelLayer node. This function works only if the active asset is a [model asset].
Parameters ​
- NodeID: The NodeID of the Object3D node to merge
Errors ​
Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND
Since ​
Version 1.0
Example ​
-- merge group1
FxObject3D.Merge("group1");Parent (NodeID, NewParentID) ​
This function will parent the specified node to the new parent, i.e. it will become a child node of the new parent. The local transformations are also adjusted so that the absolute transformations don't change.
Parameters ​
- NodeID: The NodeID of the Object3D node to parent to another node
- NewParentID: The NodeID of the new parent
Errors ​
Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND, FX_VALUE_INVALID
Since ​
Version 1.0
Example ​
-- make layer1 a child of layer2
FxObject3D.Parent("layer1", "layer2");Translate (NodeID, X, Y, Z, InLocalSpace) ​
This function offsets the position of a node in given space.
Parameters ​
- NodeID: The NodeID to identify the Object3D nodes to be translated
- X: The X-axis offset
- Y: The Y-Axis offset
- Z: The Z-Axis offset
- InLocalSpace: Whether to translate in local or world space
Errors ​
Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND
Since ​
Version 1.0
Example ​
-- Translate layer1 in local space
FxObject2D.Translate("layer1", 10.0, 2.5, 5.0, true);Unfreeze (NodeID, Translate, Rotate, Scale) ​
This function unfreezes frozen transformations. For example, by unfreezing translation the internal offset set by a previous freeze is reset to (0.0,0.0,0.0).
Parameters ​
- NodeID: The NodeID to identify the Object3D nodes to unfreeze
- Translate: Whether to unfreeze translation
- Rotate: Whether to unfreeze rotation
- Scale: Whether to unfreeze scaling
Errors ​
Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND
Since ​
Version 1.0
Example ​
-- unfreeze scaling
FxObject3D.Unfreeze("layer1", false, false, true);