AttachRigidBodies
 
 
 

AttachRigidBodies

Description

Connects rigid bodies together with a rigid constraint and places the contraint at the specified position in global space. If the input list contains only one body, the body will be attached to the world. If the list contains no bodies, a constraint will not be created.

Scripting Syntax

oReturn = AttachRigidBodies( Name, [Bodies], Px, Py, Pz );

Return Value

Returns the Constraint object.

Parameters

Parameter Type Description
Name String Type of constraint (e.g. hinge, ballsocket, spring) to attach to the rigid bodies
Bodies String List of rigid bodies

Default Value: Current selection

Px Double Constraint x coordinate (global space)

Default Value: 0

Py Double Constraint y coordinate (global space)

Default Value: 0

Pz Double Constraint z coordinate (global space)

Default Value: 0

Examples

VBScript Example

'
' Attach two cubes with a ball and socket constraint.
' Put the constraint at the origin.
'
set cube1 = CreatePrim("Cube", "MeshSurface")
SetValue cube1 & ".cube.length", 1
Translate , 2, 0, 0, siAbsolute
set cube2 = CreatePrim("Cube", "MeshSurface")
SetValue cube2 & ".cube.length", 1
Translate , -2, 0, 0, siAbsolute
CreateActiveRigidBody cube1 &","& cube2
set l_cns = AttachRigidBodies("BallSocket", cube1 &","& cube2, 0, 0, 0)
logmessage typename(l_cns)
'Results of running this script:
'INFO : "X3DObject"

See Also

SetRigidBodyInitState GetRigidBodyInitStateFromAnim CreateActiveRigidBody CreatePassiveRigidBody RemoveRigidBody