Vehicle Wrapper -- Blender 3D Game Engine


 
pageok


 
1.  Tweaking the suspension is optional

If you don't set the values for:

Tire Grip
Suspension Compression
Suspension Damping
Suspension Stiffness
Roll Influence

the default values will be used.
 
  
2.  Add Suspension.py to the Text Editor

Note:
Optional.  If you don't add Suspension.py, the default values for the suspension will be used.

Note:
If you downloaded the starting blend, you can find Suspension248.txt and Suspension249.txt in the Text Editor.  

Download:

Text Editor menu >> Text >> Open
Rename Suspension.txt to Suspension.py

 
  
3.  Suspension.py ---  Tire Grip  (Line Numbers:  51 - 63)

Note:
Tire grip can be changed at any time while the game is running.  

Note:
0 = first tire added by AddWheel in CarSetup.py
1 = second tire added by AddWheel in CarSetup.py
2 = third tire added by AddWheel in CarSetup.py
3 = fourth tire added by AddWheel in CarSetup.py

##########################################################

# set tire grip
def Tire_Grip(vehicleID):

    grip_0 = 30.0     # front driver's tire
    grip_1 = 30.0     # front passenger's tire
    grip_2 = 30.0     # rear driver's tire
    grip_3 = 30.0     # rear passenger's tire

    vehicleID.setTyreFriction(grip_0, 0)  # front driver's tire
    vehicleID.setTyreFriction(grip_1, 1)  # front passenger's tire
    vehicleID.setTyreFriction(grip_2, 2)  # rear driver's tire
    vehicleID.setTyreFriction(grip_3, 3)  # rear passenger's tire

 
  
4.  Suspension.py ---  Suspension Compression  (Line Numbers:  66 - 79)

Note:
Suspension compression can be changed at any time while the game is running.  

Note:
0 = first tire added by AddWheel in CarSetup.py
1 = second tire added by AddWheel in CarSetup.py
2 = third tire added by AddWheel in CarSetup.py
3 = fourth tire added by AddWheel in CarSetup.py

##########################################################

# set suspension compression
def Suspension_Compression(vehicleID):

    compression_0 = 6.0     # front driver's tire
    compression_1 = 6.0     # front passenger's tire
    compression_2 = 6.0     # rear driver's tire
    compression_3 = 6.0     # rear passenger's tire

    vehicleID.setSuspensionCompression(compression_0, 0)  # front driver's tire
    vehicleID.setSuspensionCompression(compression_1, 1)  # front passenger's tire
    vehicleID.setSuspensionCompression(compression_2, 2)  # rear driver's tire
    vehicleID.setSuspensionCompression(compression_3, 3)  # rear passenger's tire

 

   
pageok