Page tree
Skip to end of metadata
Go to start of metadata



Introduced in

Version:1.22

Description

Description:

Attaches a PhysX child element. Using this command creates a default createJointExt - SphereJoint joint between the two vehicles, passed to the command. It also creates a logical coupling between them, which, for example, is useful for brakes on trailers.

V2.12+: Once a child object is attached, its locality is switched to that of the parent. In earlier versions, this locality change did not happen, and could cause errors (which could be circumvented by invoking the setTowParent first).

Syntax

Syntax:parent attachChild child
Parameters:
  • parent: Object - Object that the child object is attached to.
  • child: Object - Object that is attached to the parent object.
Return Value:Nothing

Alternative Syntax

Syntax:[parent, child] attachChild jointParameters (V1.44+)
Parameters:
Return Value:Nothing

Examples

Examples:
truck attachChild trailer
Connection between truck and trailer with motorized and limited joint:
jointType = "6DOFJoint"; fromPose = []; toPose = []; misc = []; dofs = [2,1,1,0,0,0]; swing1Limit = [0,1]; swing2Limit = [0,1]; limits = [ [],[],swing1Limit,swing2Limit]; twistDrive = [0,1000,0.01]; drives = [twistDrive]; jointDesc = [limits,drives,dofs]; MyJoint = [TRUCK,TRAILER] attachChild [jointType,fromPose,toPose,misc,jointDesc];

Additional Information

See also: detachChild, childAttached, parentAttached, createJointExt
Multiplayer: 
Problems: 

Notes