Modifying Parts
Find out what every part does and what its fields mean.
Last updated
Find out what every part does and what its fields mean.
Last updated
You can modify every field of every part during runtime and the changes will be reflected in the vehicle's performance. This gives you the ability to design the vehicle's behavior in a quick way.
ScriptableObjects field values save all the changes you make during development in the editor, but not in the build, that's the feature of ScriptableObjects.
However, the changes to which scriptable object parts the controller uses that were made during runtime are reset, as well as the value type fields (such as CustomizableSet object fields, used preset field, SteerSpeed, and DrivetrainType).
To save the changes made during play mode, check the following toggle:
The engine provides torque to the drive wheels of the vehicle.
To change the properties of the engine, open TorqueCurve.
You can zoom into the curve by pressing "F" in the opened AnimationCurve window.
Torque Curve looks like this:
Where the X-axis represents the rpm, the Y-axis - the amount of torque.
The leftmost key is the idle rpm of the engine. Idle rpm can't be less than 0.
The rightmost key is the maximum rpm the engine can handle.
The horsepower label shows the approximate amount of horsepower the engine can produce, taking into account additional boost from the forced induction system.
Horsepower = peak torque value * peak torque rpm / 5252 + boost from forced induction
The max speed field defines the maximum speed that the engine can handle. If the car tries to go beyond this maximum, the opposite force would be applied.
It's not necessary to have a unique value for each engine. You can set the same max speed for every vehicle, making it the in-game limit. Artificially limiting the top speed can help with collision handling.
Note that the speed is in kilometers per hour.
Other parts, namely tires, and body, rely on the value of (current car speed / max car speed) for calculations, so keep the max speed value reasonable.
An optional field where you can assign a Forced Induction Scriptable Object.
As of update 2.1.0, ForcedInductionSO was separated from the EngineSO instance for better performance customization. Now you can assign ForcedInductionSO directly onto the CustomVehicleController.
Tires define the steering and acceleration properties of the vehicle.
Steering stiffness defines the cornering ability of a vehicle. The higher the value, the more the wheels want to go in the direction they are facing. Therefore, low values are more suitable for drift and high values - for grip.
The sideways grip curve acts as a multiplier to the steering stiffness. The value is based on how fast the vehicle is going compared to the max speed it can reach (current car speed / max car speed.)
The sideways grip curve of a vehicle with a normal grip can look like this, letting the vehicle take sharp turns at low speeds but become less stable and understeery as the car reaches the top speed:
Don't forget that the sideways grip curve is the multiplier of the steering stiffness.
If you change the curve, you should adjust the steering stiffness as well, expecting to have a steering stiffness * key[0] value at low speed and a steering stiffness value at top speed.
The sideways slip curve is another multiplier to the steering stiffness. It is based on the dot product of the vehicle movement and vehicle forward vector (the value is read from 1 - dot product).
At a value of 0 the car is moving precisely where it is facing, there is 0 slip, so a value of key[0] will be used.
When the car is sliding perpendicularly, the slip equals 1, so a value of the last key will be used.
It gives the effect of the vehicle losing some traction and sliding, not being able to move in the way the tires are pointing.
Note that the wheels that move perpendicularly to their forward vector should have maximum resistance to motion, so as the slip value approaches 1, the curve value should increase, like this:
The forward grip value defines how much force the wheel can handle before it starts slipping.
When accelerating, the weight of the vehicle shifts to the rear, increasing the load on the wheel axle. If the amount of torque provided to the drive wheel is bigger than the wheel load multiplied by the forward grip, the wheel starts slipping.
In case of the wheel slip, the car has slightly worse acceleration.
Drift tires have specific properties for the rear wheels. Even if you configure the drift tire values and assign the tire scriptable object to the front wheels, they will have no effect.
The first thing to note, if you used to make "drift" tires the old way, is that the drift tire should have normal steering stiffness and sideways grip curve values, like you would set on a grip tire.
Until the tires lose traction, they will have the maximum steering stiffness (from the Steering Stiffness and Sideways Grip Curve) and will not take into account the Sideways Slip Curve.
After losing traction, the tires will also start taking into account the Sideways Slip Curve. For proper drift, the curve should start with low values and eventually reach high value, simulating strong resistance to orthogonal motion.
The "Preserve Velocity Multiplier" is a multiplier to the additional force (the tire's forward vector projected on the rigidbody's velocity), which helps the vehicle to maintain and gain speed during drift. Values too high can result in unnatural or broken acceleration, the recommended range of values is [0.9-1.1]
This curve is an additional multiplier to the "Preserve Velocity Multiplier" based on the angle of the drift. X-axis is the dot product between the vehicle's velocity and tire's right axis, Y-axis is a multiplier. Increasing the multiplier as the drift angle increases helps the car to not lose speed.
Auto Straightening Strength is a multiplier to the natural force that counteracts the drift force. Increasing this value can help exit the drift more easily, thus giving more control to the player. This value is scaled by the angle of the drift (the less the angle the higher the force) and rigidbody's angular velocity around the Y axis (rapid transitions during drift lower this force).
Auto Straightening Filter scales the amount of the force that straightens the vehicle depending on the drift angle. This value is used as a power the drift angle is taken to, thus increasing this value drastically lowers the influence of higher angle drifts.
"No Acceleration Effect Multiplier" multiplies the resulting straightening force when there is 0 acceleration input from the user.
To enter the drift, at least 1 condition must be met.
"Angular Velocity Change Rate" is a threshold that can cause the vehicle to start drifting if overcame. This value is scaled by the rigidbody's angular drag, thus making drift initiation less likely at higher speed (drag is increased depending on the Vehicle Body's "Cornering Resistance Curve"). If tuned correctly, this value can make the vehicle enter the drift only by inertia drift (the angular acceleration of the rigidbody will be high after changing the movement direction quickly enough.)
"Forward Grip" property in the "Drift Parameters" is the same property that in your normal tires, it has been duplicated to show that it can be another reason for the vehicle to start drifting. If the torque, applied to the wheel is higher than the current load on the tire multiplied by the forward grip, the vehicle can start drifting. (load increases on the rear wheels during acceleration and reduces during deceleration).
Another condition for entering the drift is a sudden increase in torque. If the torque change rate multiplied by the angular velocity around the Y axis is higher higher than the tire load multiplied by the tire's forward grip and vehicle's speed, the vehicle can start drifting. (Meaning the vehicle is turning at low speed and a large amount of torque is applied instantly to the wheels. If the speed is high, the car has lower power or the car isn't turning, this won't result in drift entry.)
The handbrake guarantees drift entry in most cases as it increases the angular velocity of the car rapidly.
If gas and brake input are provided at the same time and the gas input is higher or equal, this can help the car to enter the drift smoothly.
To exit the drift, all conditions must be met
Drift Angle is represented as a dot product between the rigidbody's velocity and the tire's right axis. If the drift angle is below this value, the vehicle can stop drifting.
If the rigidbody's angular velocity is below this value, the vehicle can stop drifting. Note that during drift transitions where the direction the vehicle is moving changes rapidly, the angular velocity will be higher than when just turning or drifting in 1 direction.
You can either calculate the whole gear ratios list by pressing the "Calculate Gear Ratios" button or by having the "Auto Calculate Gear Ratios" foldout opened and adding the gears by pressing the "+" sign. The new gear ratio will be based on the current gear change rate value and the first gear ratio.