| Methods: |
| getConstraintId |
testMethod |
|
|
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)
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")
|