CreateTransformGroup

Introduced

v5.0

Categories

group

Description

Reparents the objects in the input list under a transform group object. A transform group is a special type of null that allows you to parent a number of objects for group transformations. Transform groups are not visible by default. Transform groups can be made visible in Camera Visibility > Objects > Control Objects > Transform Groups. Note that a transform group is not the same as a Group. Unlike transform groups, groups are not 3D objects and do not affect the parenting of their members.

This command positions a transform group null at the location of the nearest common ancestor of all the objects in the input list. If there are no input objects, the transform group will be placed under the scene root. The command branch selects the new transform group.

Note: Bones cannot be part of a transform group because they cannot be reparented.

Scripting Syntax

oReturn = CreateTransformGroup( [Name], [InputObjs] );

Return Value

Returns the transform-group (an X3DObject object).

Parameters

Parameter Type Description
Name String Name of the group

Default Value: "Group"

InputObjs String List of objects to put in the group.

Default Value: Selected objects

Examples

JScript Example

/*
        This example will transform group a cone twice, making a hierarchy 3 objects deep. 
        Each object will be offset by 5 units in Y.
*/
// Make transform groups visible in the camera view
SetValue("Camera.camvis.objctrltransfogroups", true, null);
// Create and position the cone
var oCone = CreatePrim("Cone", "MeshSurface");
var pos = XSIMath.CreateVector3();
pos.Set(0,5,0);
oCone.LocalTranslation = pos;
// Transform group the cone and offset the group 5 units in Y
var oXfmGroup = CreateTransformGroup(null, "cone");
LogMessage("---1st group created---");
LogMessage("1st group's parent:" + oXfmGroup.Parent);
LogMessage("1st group         :" + oXfmGroup.Name);
LogMessage("1st group's child :" + oXfmGroup.Children(0));
oXfmGroup.LocalTranslation = pos;
// Group the cone again offset the new group.
var oXfmGroup2 = CreateTransformGroup(null, "cone");
//Move the Transform Group up
oXfmGroup2.LocalTranslation = pos;
LogMessage("-----------------------");
LogMessage("---2nd group created---");
LogMessage("1st group's parent:" + oXfmGroup.Parent);
LogMessage("1st group         :" + oXfmGroup.Name);
LogMessage("1st group's child :" + oXfmGroup.Children(0));
LogMessage("-----------------------");
LogMessage("2nd group's parent:" + oXfmGroup2.Parent);
LogMessage("2nd group         :" + oXfmGroup2.Name);
LogMessage("2nd group's child :" + oXfmGroup2.Children(0));
/////////////////////////////////////
// Output from running this script:
/////////////////////////////////////
//INFO : ---1st group created---
//INFO : 1st group's parent:Scene_Root
//INFO : 1st group         :transfogroup
//INFO : 1st group's child :cone
//INFO : -----------------------
//INFO : ---2nd group created---
//INFO : 1st group's parent:Scene_Root
//INFO : 1st group         :transfogroup
//INFO : 1st group's child :transfogroup1
//INFO : -----------------------
//INFO : 2nd group's parent:transfogroup
//INFO : 2nd group         :transfogroup1
//INFO : 2nd group's child :cone

See Also

RemoveTransformGroup