Class KX_VehicleWrapper -- Blender Game Engine 2.49b



 
 





addWheel


addWheel(wheel, wheelPos, axlePos, wheelAxis,
  suspensionHeight, wheelRadius, steering)

Adds a wheel to the vehicle.

wheel:
Type:  KX_GameObject
(The game model of the tire.)

wheelPos:
Tire position from vehicle object center.
Type:  float list [ x, y, z]
Uses local x, y, z float values.

suspensionAngle:
Cosine of the angle (uses vehicle object center axis)
Type:  float list [x, y, z]
Range  -1.0 to 1.0

wheelAxis:
Axis of the tire used to attach it to the axle.
Type:  float list [ xAxis, yAxis, zAxis]
Range -1.0 to 1.0 

suspensionHeight:
Height of the suspension.  Local value.
Type:  float.

wheelRadius:
Radius of the tire.
Type:  float

steering:
   Type:   Bool
True or 1 = tire used for steering.
False or 0 = tire not used for steering.

Sample Code

#import PhysicsConstraints
import PhysicsConstraints

# get list of objects in scene
objList = GameLogic.getCurrentScene().objects

# get vehicle object named car
objCar = objList["OBCar"]
   
# keep the vehicle active, otherwise simulation stops
objCar.applyImpulse([ 0.0, 0.0, 0.0], [ 0.0, 0.0, 0.0])
   
# get car physics ID
car_PhysicsID = objCar.getPhysicsId()
 
# create a vehicle constraint
vehicle_Constraint = PhysicsConstraints.createConstraint(car_PhysicsID, 0, 11)
 
# get the constraint ID
constraint_ID = vehicle_Constraint.getConstraintId()

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

# get the vehicle constraint ID
vehicle = PhysicsConstraints.getVehicleConstraint(constraint_ID)

# use the object names to get the tires
tire_FD = objList["OBTire_1"]
tire_FP = objList["OBTire_2"]
tire_RD = objList["OBTire_3"]
tire_RP = objList["OBTire_4"]

# Front driver tire position from car object center
tirePos_FD = [ -2.0, 4.0, -2.0]

# Front passenger tire position from car object center
tirePos_FP = [ 2.0, 4.0, -2.0]

# Rear driver tire position from car object center
tirePos_RD = [ -2.0, -4.0, -2.0]

# Rear passenger tire position from car object center
tirePos_RP = [ 2.0, -4.0, -2.0]

# suspension angle from car object center
suspension_Angle = [ 0.0, 0.0, -1.0]

# tire axis attached to car axle
tireAxis = [ -1.0, 0.0, 0.0]

# set suspension height
suspensionHeight_FD = 0.2
suspensionHeight_FP = 0.2
suspensionHeight_RD = 0.2
suspensionHeight_RP = 0.2

# set tire radius
tireRadius_FD = 1.0
tireRadius_FP = 1.0
tireRadius_RD = 1.0
tireRadius_RP = 1.0

# tire has steering?
tireSteer_FD = True
tireSteer_FP = True
tireSteer_RD = False
tireSteer_RP = False

# Add front driver tire (tire 0)
vehicle.addWheel( tire_FD, tirePos_FD, suspension_Angle, tireAxis,
                      suspensionHeight_FD,  tireRadius_FD, tireSteer_FD )

# Add front passenger tire (tire 1)
vehicle.addWheel( tire_FP, tirePos_FP, suspension_Angle, tireAxis,
                      suspensionHeight_FP,  tireRadius_FP, tireSteer_FP )

# Add rear driver tire (tire 2)
vehicle.addWheel( tire_RD, tirePos_RD, suspension_Angle, tireAxis,
                      suspensionHeight_RD,  tireRadius_RD, tireSteer_RD )

# Add rear passenger tire (tire 3)
vehicle.addWheel( tire_RP, tirePos_RP, suspension_Angle, tireAxis,
                      suspensionHeight_RP,  tireRadius_RP, tireSteer_RP )

   
Game developers can use the game engine to create casual video games, first and third person shooters, role playing games, racing simulations and more. The game engine can be used to make both 2D games and 3D games.  Beginning game developers will only need basic knowledge of game design and programming to create rich and complex game models with photo realistic textures to add detail to the graphics of the video game.  Today's games need more than good looking low polygon game models.  Use normal maps and photo realistic textures to create high quality game models.