18 lines
898 B
Plaintext
18 lines
898 B
Plaintext
#title CreateHingeConstraint [RCBasic Doc]
|
|
#header function CreateHingeConstraint( actorA, frameA, useReferenceFrameA )
|
|
|
|
Simulates a hinge joint, which allows two actors (or an actor and the world) to rotate around a single axis while restricting movement along the other axes. This is similar to the way a door swings on its hinges or how an elbow joint functions in the human body.
|
|
|
|
#code
|
|
actorA = CreateCubeActor(100) 'Creates a cube actor
|
|
frameA = DimMatrix(4, 4) 'A transform matrix must be a 4x4 matrix
|
|
SetIdentityMatrix(frameA, 4) 'Sets frameB to a 4x4 identity matrix
|
|
SetMatrixTranslation(frameA, 0, 1, 0) 'Sets the attach point of the constraint to the top of the cube
|
|
hinge = CreateHingeConstraint(actorA, frameA, true)
|
|
#/code
|
|
|
|
Note: It is recommended to use CreateSlideConstraintEx() in most cases
|
|
|
|
#ref CreateHingeConstraintEx SetIdentityMatrix SetMatrixTranslation SetMatrixRotation
|
|
|