################# 6DOF Rotational Motor Constraint
import PhysicConstraints Module
import PhysicsConstraints
get current scene
scene = GameLogic.getCurrentScene()
get object list
objList = scene.objects
get object named OBCube_Green
obj1 = cont.owner
get object named OBCube_Red
obj2 = objList[“Center”]
want to use a 6DOF constraint
constraintType = 12
get obj1 physics ID
obj1_ID = obj1.getPhysicsId()
get obj2 physics ID
obj2_ID = obj2.getPhysicsId()
Use center of obj1 for pivot point
pivotPos_X = 0.0
pivotPos_Y = 0.0
pivotPos_Z = 0.0
Make pivot axis orientation same as obj1 axis
pivotAxis_X = 0.0
pivotAxis_Y = 0.0
pivotAxis_Z = 0.0
disable collisions between obj1 & obj2
flag = 128
create a 6DOF constraint
cube_6DOF = PhysicsConstraints.createConstraint( obj1_ID, obj2_ID,
constraintType,
pivotPos_X, pivotPos_Y, pivotPos_Z,
pivotAxis_X, pivotAxis_Y, pivotAxis_Z,
flag)
set rotation around pivot x and y axis to zero
cube_6DOF.setParam(3, 0.0, 0.0)
cube_6DOF.setParam(4, 0.0, 0.0)
create rotational motor around the pivot z axis
cube_6DOF.setParam(11, 1.0, 100)
is what I have so far, but don’t know how to convert a X,Y,Z - to a rotation matrix
or is
cube_6DOF.setParam(3, 0.0, 0.0)-X axis?
cube_6DOF.setParam(4, 0.0, 0.0)-Y axis
cube_6DOF.setParam(5, 0.0, 0.0) -Z???