Step 3.
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.
http://http://udn.epicgames.com/Thre...led%20Vehicles
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.
Code:
class UTVehicle_MyCar_Content extends UTVehicle_MyCar
placeable;
to make your cars physics alive at level start you need to add this line in the PostBeginPlay() function in UTVehicle_MyCar.
Mesh.WakeRigidBody();
Code:
simulated event PostBeginPlay()
{
blah stuff here
...
Mesh.WakeRigidBody();
}
compile the script and open the editor.
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.
Wheel Radius.
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.
Wheel Slip.
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
Code:
// Longitudinal tire model based on 10% slip ratio peak
WheelLongExtremumSlip=0.3
WheelLongExtremumValue=1.0
WheelLongAsymptoteSlip=1.0
WheelLongAsymptoteValue=0.9
// Lateral tire model based on slip angle (radians)
WheelLatExtremumSlip=0.8 // 20 degrees
WheelLatExtremumValue=0.9
WheelLatAsymptoteSlip=0.5 // 80 degrees
WheelLatAsymptoteValue=1.5
*note you will probably have to change these values again when we speed the car up.
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.
Code:
class UTVehicleMyCarWheel extends UDKVehicleWheel;
defaultproperties
{
WheelRadius=27
...
LongSlipFactor=2.0
LatSlipFactor=2.75
Speed.
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.
Code:
defaultproperties
{
blah blah lots of stuff here
..
MaxSpeed=8500
}
Gearbox.
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.
Code:
TorqueVSpeedCurve=(Points=((Reverse),(First Gear),(Second),(Third),(Fourth),(Fifth)))
here is TorqueVSpeedCurve from one of my cars to get you started. not super fast but definately not slow.
Code:
TorqueVSpeedCurve=(Points=((InVal=-590.0,OutVal=0.0),(InVal=-100.0,OutVal=28.0),(InVal=0.0,OutVal=55.0),(InVal=450.0,OutVal=60.0),(InVal=6050.0,OutVal=10.0),(InVal=9150.0,OutVal=0.0)))
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.
Other Stuff.
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.
EngineBrakeFactor=0.005
to give the brakes a more realistic force change this.
MaxBrakeTorque=25.0
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
Code:
MaxSteerAngleCurve=(Points=((InVal=0,OutVal=25),(InVal=600.0,OutVal=20.0),(InVal=3100.0,OutVal=16.0),(InVal=4400.0,OutVal=12.0),(InVal=5000.0,OutVal=9.0)))
also for a quick fix change this.
MinHardTurnSpeed=99999.0
to make the vehicle able to hold a drift change this.
WheelLatAsymptoteSlip=8.4
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.
Bookmarks