Modify your cars performance.
A bit about the physics, bear this in mind when you are tuting your car.
as i suspected the wheels play no part in the physics of the car, instead they are merely a visual representation and forces are applied to the car chassis directly.
Wheeled vehicles in Unreal Engine 3 are simulated as a single rigid body. Ray-casts are made from points on the car chassis downwards to see where they hit the ground, and forces are computed at the contact point based on a number of parameters. There are no physical `wheel' objects - the engine just stores how fast each wheel is moving, and uses that in the calculations for forces generated.
for this step we will make the vehicle 'placeable' so we can play with the cars settings in the editor.
open UTVehicle_MyCar_Content and add the word placeable like this.
to make your cars physics alive at level start you need to add this line in the PostBeginPlay() function in UTVehicle_MyCar.
class UTVehicle_MyCar_Content extends UTVehicle_MyCar
compile the script and open the editor.
simulated event PostBeginPlay()
blah stuff here
open the Actor Browser and go down to vehicles. you will now see UTVehicle_MyCar_Content as well as UTVehicleFactory_MyCar.
drag UTVehicle_MyCar_Content onto your map and double click (or f4) to open its properties.
here we can change almost every variable involved in the handling of your car. it will not save the changes into your script but serves as a testing platform.
the chances are that your car wheels are not the same size as the scorpions, so we will sort that out now.
with the car properties open in the editor, click on SVehicle and you will see 'Wheels'.
click the arrow to the left of it to open it further. you will see 0, 1, 2, 3 each with an arrow, these are your 4 wheels.
open 0, then SVehicle Wheel and you will see all sorts including 'Wheel Radius'.
change the number on all the wheel objects to make them bigger or smaller so that your car wheels look as if they are on the ground, not floating in the air or sunk into the ground.
whilst you have the wheel object properties open lets have a play with the tyre grip. look for Long Slip Factor and Lat Slip Factor.
Long Slip is forwards grip and Lat Slip is sideways.
depending on the speed, size and shape of your vehicle this can be anywhere from around 1.0 to 3.0. 1.5 is a good starting point.
Lat and Long slip scale the slip curve defined in the SimObject, this is where your 'real' grip is defined.
ie this bit
*note you will probably have to change these values again when we speed the car up.
// Longitudinal tire model based on 10% slip ratio peak
// Lateral tire model based on slip angle (radians)
WheelLatExtremumSlip=0.8 // 20 degrees
WheelLatAsymptoteSlip=0.5 // 80 degrees
once you find the correct wheel radius and good slip factors you can put it in your wheel script. open UTVehicleMyCarWheel and change it there to make it permanent.
class UTVehicleMyCarWheel extends UDKVehicleWheel;
the main thing holding back the scorpions top speed is a limit that has been set on the physics called 'MaxSpeed'. lets bump that up now.
open UTVehicle_MyCar and add this line in the DefaultProperties block, put it at the end so you can find it again easily.
DefaultProperties contains all the goodies we will mess with.
blah blah lots of stuff here
keep UTVehicle_MyCar open.
the gearbox is defined as an array called TorqueVSpeedCurve.
you will find it in DefaultProperties inside the SimObject. its full of numbers that need to be changed but ill write words to show you whats going on.
here is TorqueVSpeedCurve from one of my cars to get you started. not super fast but definately not slow.
you can mess around with these values in the editor.
in the car properties go down to SVehicle - Sim Obj - UDKVehicle Sim Car
open TorqueVSpeedCurve - Points
these are your gears, Inval is speed, OutVal is torque.
here are some things you might like to change. they can all be found in the Sim Object.
the scorpion grinds to an abrupt halt as soon as you stop accelerating. to make it more realistic so the car free wheels change this.
to give the brakes a more realistic force change this.
now that your car goes really fast you will notice you cannot steer at high speeds. change the values in MaxSteerAngleCurve.
this works for my cars
also for a quick fix change this.
to make the vehicle able to hold a drift change this.
these are the most usefull things to change but you now have the freedom to play with almost any setting in the editor.
by now you should have your own car that goes fast and drifts well
if not please have a look at the next post.