Blender 3D game engine: KX_ConstraintWrapper
Methods:
getConstraintId testMethod
Variables:
---------- ----------
Constants:
---------- ----------
Inherited
Methods:
isA ----------



Instance Methods

getConstraintId

getConstraintId()

Returns the constraint ID.

Returns 0 if Actor and Dynamic aren't turned on.

Return type:  integer

Sample Code


# import PhysicConstraints Module
import PhysicsConstraints

# get object list
objList = GameLogic.getCurrentScene().getObjectList()

# get object named Car
objCar = objList["OBCar"]

# want to use vehicle constraint type
constraintType = 11

# get car physics ID
car_ID = objCar.getPhysicsId()

# create a vehicle constraint
carConst = PhysicsConstraints.createConstraint( car_ID, 0, constraintType)
 
# get the constraint ID
constraint_ID = carConst.getConstraintId()

# save constraint_ID as a car variable
objCar.constraint_ID = constraint_ID

# get vehicle constraint
car = PhysicsConstraints.getVehicleConstraint(carConst_ID)



Example blend: 

testMethod

testMethod()

Note:
Always returns None.

Sample Code

# import PhysicsConstraints module
import PhysicsConstraints

# get controller
controller = GameLogic.getCurrentController()

# get owner
owner  = controller.getOwner()

# get Physics ID
physicsID = owner.getPhysicsId()
 
# create a vehicle constraint
ownConst = PhysicsConstraints.createConstraint(physicsID,0,11)
 
# test method
test = ownConst.testMethod()





isA

isA(Type)

Checks the Object type.
(KX_GameObject, SCA_ILogicBrick, KX_Scene, etc.)

Type:  String

Return Type:  Bool
1 = True
0 = False

Sample Code

# get the controller
controller = GameLogic.getCurrentController()

# get the object controller attached to
owner = controller.getOwner()

# is owner a GameObject?
gameObject = owner.isA("KX_GameObject")


Blender 3D
Game Engine
Rapid prototyping for 3D games. Test realtime 3D gameplay without having to compile the game code. 3D game models automatically added.  GLSL shaders. Normal Mapping and Parallax Mapping. All OpenGL Lighting modes. This includes transparencies, animated and reflection mapped textures. Multiple textures and materials. UV mapping. Per-pixel lighting and dynamic lighting.  Uses Bullet Physics. Soft body dynamics. Rigid body dynamics. Collision detection and dynamics simulation. Collision bounds of all types. Car physics engine with full support for vehicle dynamics. (Spring reactions, stiffness, damping, tire friction etc.).