Vehicle Constraint: getConstraintType

getConstraintType()
  • Returns the constraint type.

Return Type:
  • integer
Note:
  • The constraint type is NOT the same thing as the constraint ID.
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 vehicle constraint ID
id_number = car_Constraint.getConstraintId()

# create the vehicle
vehicle = bge.constraints.getVehicleConstraint(id_number)

# get the constraint type
type_number = vehicle.getConstraintType()