The def controllerAI() inside the Script “carControll.py” does the controlling of the vehicle in this file you will find all the calculations.
The lines that are the SAME COLOR as the Car’s Stripe are Vectors that are used in the calculation of the Path he needs to follow.
The WHITE line is used to calculate the Angle to the furthest point of the Track possible in the current speed of the vehicle.
The RED line that eventually appears is the Ray casting that verifies proximity of other vehicle, in other words, the eyes of the driver.
Nicely done!!!. For the first time I see a working and smart racing AI !! I really like how the cars are avoiding each other.
I’ve got one problem with the blend file, did you pack textures with it becouse I don’t see them.
Read new prefs: C:\Users\barbara\AppData\Roaming\Blender Foundation\Blender\2.72\config\userpref.blendfound bundled python: C:\Program Files\Blender Foundation\Blender\2.72\pythonread blend: C:\Users\barbara\Desktop\Blender Racing 0.04.blendTraceback (most recent call last): File "C:\Users\barbara\Desktop\Blender Racing 0.04.blend\carControll.py", line 1, in ImportError: No module named 'bge'
The car is using the car constraints physics similar to the one found HERE It’s quite good, also In the Motor.py Script I implementer the car’s gear ratio explained HERE and HERE also the gear values in:
line 122: GearRatio = [3.78, 2.12, 1.27, 0.87, 0.66]
Are the actual value for this model of Jetta. So the speed of the vehicle for example in first gear at 2000 RPM is the actual speed that the real Jetta would go at.
line 165: maxSpeed = ((82.1 * own[“RPM”]) / (GearRatio[own[“GEAR”]]*3.42))/1000
The RPM can be calculated from the current speed:
line 136: own[“RPM”] = ( ( (ownSpeed*1000) * (GearRatio[own[“GEAR”]]*3.42) ) / 82.1 ) + power
power is the power that the driver is applying to the car, in other words, the gas.
Sorry I forgot some textures, it’s probably from the driver model… Also the audio issue is something that I don’t know how to solve, the current audio actuator and library could use some changes or I don’t use it right…
Apparently you geting and error importing the blender game engine library, strange I don’t know how to address that… sorry…
Thank you friend, feel free to use it in the Festival of Speed, but I’ll soon updated it again with some better features…