Files
RCBASIC4/doc/bu/files/createconeconstraintex.txt

24 lines
1.4 KiB
Plaintext

#title createConeConstraintEx [RCBasic Doc]
#header function createConeConstraintEx( actorA, actorB, rbAFrame_matrix, rbBFrame_matrix)
The Cone Constraint is a type of joint constraint used to simulate realistic rotational movement between two actors (or between an actor and the world) with specific angular limits. This constraint is especially useful for simulating ball-and-socket joints with some twisting freedom but restricted cone-like movement, such as human shoulders or robotic arms.
#code
actorA = CreateCubeActor(100)
actorB = CreateCubeActor(100)
rbA = DimMatrix(4, 4) 'A transform matrix should be a 4x4 matrix
SetIdentityMatrix(rbA, 4) 'This will set rbA to a 4x4 identity matrix
SetMatrixTranslation(rbA, 0, 40, 0) 'Set the point where the constraint connects to actorA to 1 unit above its origin
SetMatrixRotation(rbA, 0, 0, 0) 'Sets the angle the constraint is attached at to 0 on all axes
rbB = DimMatrix(4, 4) 'A transform matrix should be a 4x4 matrix
SetIdentityMatrix(rbB, 4) 'This will set rbA to a 4x4 identity matrix
SetMatrixTranslation(rbB, 0, 40, 0) 'Set the point where the constraint connects to actorA to 1 unit above its origin
SetMatrixRotation(rbB, 0, 0, 0) 'Sets the angle the constraint is attached at to 0 on all axes
test_cone = CreateConeConstraint( actorA, rbA )
#/code
#ref CreateConeConstraint SetIdentityMatrix SetMatrixTranslation SetMatrixRotation