Vehicle Constraint: getNumWheels

getNumWheels()
  • Returns the number of wheels that have been added to the vehicle.

Return Type:
  • integer
Sample Code

################ get number of wheels added

#import bge
import bge

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

# get object list
objList = scene.objects

# get vehicle object named car
objCar = objList["Car"]
    
# Retrieve constraint ID you saved as a property when you created the vehicle constraint
constraint_ID = objCar["constraint_ID"]

# get the vehicle
vehicle = bge.constraints.getVehicleConstraint(constraint_ID)
 
# get the number of wheels added to the vehicle
tires_number = vehicle.getNumWheels()