# Physics Constraints 6 DOF Linear Spring: 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)
• Linear/Rotational Motor

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

• 6 = x axis linear

• 7 = y axis linear

• 8 = z axis linear

• 9 = x axis rotation

• 10 = y axis rotation

• 11 = z axis rotation
speed:
• movement speed

• Type: float
acceleration:
• acceleration

• Type: float
setParam(axis, stiffness, elasticity)
• Linear/Rotational Spring

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

• 12 = x axis

• 13 = y axis

• 14 = z axis

• 15 = x axis rotation

• 16 = y axis rotation

• 17 = z axis rotation
stiffness:
• stiffness of the spring.

• Type: float
elasticity:

• Type: float Sample Code ################  create a linear spring

# 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 min/max amount spring can move up/down on z axis
cube_6DOF.setParam(2, -5.0, 0.0)

# set rotation around pivot 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 an linear spring on the z axis
# stiffness of 50.0  Elasticity of 0.01
cube_6DOF.setParam(14, 50.0, .01)