
- Returns the constraint ID.
- Returns 0 if there isn't a constraint ID.
- integer
- The constraint ID is NOT the same thing as the constraint type.
- The BGE assigns a new--and sometimes different--constraint ID number each time the constraint is created.

################ get the constraint ID
# 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 point to point constraint
constraintType = 1
# get obj1 physics ID
obj1_ID = obj1.getPhysicsId()
# get obj2 physics ID
obj2_ID = obj2.getPhysicsId()
# Use front bottom right corner of obj1 for pivot point
pointPos_x = 1.0
pointPos_y = -1.0
pointPos_z = -1.0
# create a point to point constraint
cube_PtoP = bge.constraints.createConstraint( obj1_ID, obj2_ID, constraintType, pointPos_x, pointPos_y, pointPos_z )
# get the constraint ID
id_number = cube_PtoP.getConstraintId()