# Physics Constraints 6 DOF Linear Motor: setParam

setParam(axis, min, max)
• movement on the x, y and z axis.

• Object 2 moves.  But uses Object 1 axis to move on.

axis:
• Type: integer
• 0 = x axis
• 1 = y axis
• 2 = z axis
• 3 = x axis rotation
• 4 = y axis rotation
• 5 = z axis rotation
min:
• minimum distance (0.0 is Object 2 object center)

• Type: float
max:
• maximum distance (0.0 is Object 2 object center)

• Type: float
setParam(axis, speed, acceleration)
• Motor
• Object 2 moves.  But uses Object 1 axis to move on.

axis:
• Type: integer
• 6 = x axis
• 7 = y axis
• 8 = z axis
• 9 = x axis rotation
• 10 = y axis rotation
• 11 = z axis rotation
speed:
• movement speed

• Type: float
acceleration:
• acceleration
• Type: float
Sample Code

################  create a linear motor

# import bge
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get object list
objList = scene.objects

# get object named Cube_Green
obj1 = objList["Cube_Green"]

# get object named Cube_Red
obj2 = objList["Cube_Red"]

# 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 the object center of obj1 for pivot point
pivotPos_X =  0.0
pivotPos_Y =  0.0
pivotPos_Z = 0.0

# create a 6DOF constraint
cube_6DOF = bge.constraints.createConstraint( obj1_ID, obj2_ID, constraintType,
pivotPos_X, pivotPos_Y, pivotPos_Z)

# set amount object 2 can travel on object 1 x axis
cube_6DOF.setParam(0, 0.0, 10.0)

# set rotation of object 2 around object 1 x, y and z axis to zero
cube_6DOF.setParam(3, 0.0, 0.0)
cube_6DOF.setParam(4, 0.0, 0.0)
cube_6DOF.setParam(5, 0.0, 0.0)

# create linear Motor along object 2 x axis
# speed of -30.0  acceleration of 0.3

cube_6DOF.setParam(6, -30.0, .3)