Vehicle Constraint: constraint_type

constraint_type
  • Returns the constraint type

Return Type:
  • integer
Constraint Type:
  • 0 = No Constraint
  • 1 = bge.constraints.POINTTOPOINT_CONSTRAINT
  • 2 = bge.constraints.LINEHINGE_CONSTRAINT
     
  • 3 = bge.constraints.ANGULAR_CONSTRAINT
     
  • 4 = bge.constraints.CONETWIST_CONSTRAINT
  • 11 = bge.constraints.VEHICLE_CONSTRAINT
  • 12 = bge.constraints.GENERIC_6DOF_CONSTRAINT (6 Degrees Of Freedom)
Sample Code

################  get the constraint type

# import bge
import bge

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

# get object list
objList = scene.objects

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

# want to use a vehicle constraint
constraintType = 11

# get obj1 physics ID
obj1_ID = obj1.getPhysicsId()

# there isn't any obj 2
obj2_ID = 0

# create a vehicle constraint
car_Constraint = bge.constraints.createConstraint( obj1_ID, obj2_ID, constraintType )

# get the constraint type
type = car_Constraint.constraint_type