Changes between Initial Version and Version 1 of CarControl


Ignore:
Timestamp:
2011-09-17 12:07:13 (13 years ago)
Author:
edy
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CarControl

    v1 v1  
     1{{{ #!Markdown 
     2 
     3# CarControl 
     4 
     5Main script for controlling and configuring the vehicle. All parameters that affect the behavior & handling are defined here (except suspension parameters: spring, damper, distance, radius, which are configured on each wheel). 
     6 
     7This is script is added to the root GameObject of the vehicle. 
     8 
     9#### WheelFL, WheelFR, WheelRL, WheelRR: 
     10 
     11References to the four WheelCollider components of the vehicle. Each physic wheel is a GameObject containing a WheelCollider component and a [CarWheel](wiki:CarWheel) script. 
     12 
     13#### AntiRollFront, AntiRollRear: 
     14 
     15References to the AntiRollBar scripts. These scripts are typically added also to the vehicle's root GameObject. 
     16 
     17#### CenterOfMass: 
     18 
     19Reference to an empty child GameObject positioned at the vehicle's Center Of Mass. 
     20 
     21#### ForwardWheelFriction, SidewaysWheelFriction: 
     22 
     23Parameters of the forward and sideways friction curves. See the documentation on the Friction Curves (TO-DO) for detailed information on how the curves work. Also, use the tire telemetry ([CarTelemetry](wiki:CarTelemetry), B then shift-B at the Live Demo) for showing the resulting curve in real-time. Ensure the _optimized_ property (below) to be disabled when modifying these parameters in real-time. 
     24 
     25Briefly: (typical parameter range in parenthesis) 
     26 
     27- __grip__ (100..2500): grip factor. The bigger, the more difficult is to make the tire to slide. Too much sideways grip can cause the vehicle to roll over on curves. The forward grip is internally adjusted to match the maximum forward acceleration defined at motorPerformancePeak. 
     28 
     29- __gripRange__ (1..8): amount of slip in m/s on which the tire can keep its strong grip. The slip value at which the tire offers the maximum force is usually within the first half of this value, then it starts losing grip. 
     30 
     31- __drift__ (50..800, should be equal or smaller than grip): grip factor when the tire slip has surpased the limit gripRange+1. The less value, the more grip is lost when the slip limit is reached. 
     32 
     33- __driftSlope__ (-0.1..+0.1): amount of grip factor that is gained (positive) or lost (negative) when the tire slip increases below gripRange+1. 0 means constant factor at any slip over the limit. 
     34 
     35__Optimized:__ Disable for adjusting the Friction Curves in real-time. If enabled, the interal parameters for the Friction Curves are calculated only once at the beginning. Keep disabled for development & fine tunning, enable for deploying the project. 
     36 
     37## Input parameters 
     38 
     39The [CarInput](wiki:CarInput) script controls these input parameters, and allows to switch among several vehicles. Here you can configure the _steerMax_, _motorMax_, and _brakeMax_ properties. 
     40 
     41__steerInput__ (-1.0..+1.0): action on the steering wheel. -1 = full left, 0 = centered, +1 = full right. The maximum steering angle in degrees is set at steerMax. 
     42 
     43__motorInput__ (0..1.0): action on the accelerator (throttle). The maximum amount of slip in m/s applied to the drive wheels when motorInput is 1.0 is set at motorMax. 
     44 
     45__brakeInput__ (0..1.0): action on the brakes. The maximum amount of braking slip in m/s applied to the wheels when brakeInput is 1.0 is set at brakeMax. 
     46 
     47__handBrakeInput__ (0..1.0): action on the hand brake. 1.0 means rear wheels are locked. 
     48 
     49__gearInput__ (-1..+1): gear, actually only -1 (R), 0 (N) and +1 (D) are available. 
     50 
     51__steerMax__ (degrees): maximum wheel steering when steerInput is +-1. 
     52 
     53__motorMax__ (m/s): maximum traction slip applied to the drive wheels when motorInput is 1.0. 
     54 
     55__brakeMax__ (m/s): maximum braking slip applied to the wheels when brakeInput is 1.0. 
     56 
     57## Driving aids 
     58 
     59The [CarSettings](wiki:CarSettings) script control these parameters, and allows to configure the aids available on each vehicle. 
     60 
     61__autoSteerLevel__ (0.0..1.0+): (named as ESP in the Live Demo) limits the steering angle with the speed, so the sideways slip at the front wheels doesn't surpases the tire's maximum force. Values below 1.0 allow bigger steering angles, reaching or surpasing the grip limit accordingly. 0.0 disables this feature. 
     62 
     63__autoMotorMax__: (Traction Control, TC) limits the traction slip to the value of the tire's maximum forward force. 
     64 
     65__autoBrakeMax__: (ABS) limits the braking slip to the value of the tire's maximum forward force. 
     66 
     67__antiRollLevel__ (0.0..1.0+): configures the efficiency of the anti-roll bars (AntiRollBar). 1.0 = normal, 0.5 = half force, 0.0 = disabled. Different values here are show as Offroad, Confort and Sport at the [Live Demo][1] (red car, key 5 for change this setting). 
     68 
     69## Performance & behavior parameters 
     70 
     71__motorPerformancePeak__ (1.0-10.0): Maximum acceleration in m/s2 that the car would receive when four wheels drive are applying their maximum forward friction force (i.e. when autoMotorMax is enabled), being motorForceFactor = 1.0. 
     72 
     73This value defines the maximum theoretical acceleration of the vehicle. It's not an exact value beacuse the maximum tire force is an estimation, and the transfers of masses have influence as well. You must experiment with it until finding the proper acceleration for your vehicle.  
     74 
     75If the vehicle is 2 wheels drive, then motorForceFactor (below) should be 2.0 for reaching a similar acceleration (the final value depends on the drive wheels being front or rear, and the mass transfer caused by the acceleration itself). 
     76 
     77__motorForceFactor__ (1.0..2.0+): multipler of the grip factors of the forward friction curves when the wheel is applying traction force. Use 1.0 for 4 wheels drive vehicles, 2.0 for 2 wheels drive. Controlled from [[CarSettings]] if available. 
     78 
     79__motorBalance__ (0.0..1.0): 0.0 = front wheels drive, 1.0 = rear wheels drive, 0.5 = full wheel drive. Controlled from [CarSettings](wiki:CarSettings) if available. 
     80 
     81__brakeForceFactor__ (1.0+): multipler of the grip factors of the forward friction curves when the wheel is applying brake force. Use valores greater than 1.0 for increasing the power of the brakes. 
     82 
     83__brakeBalance__ (0.0..1.0): 0.0 = only front brakes, 1.0 = only rear brakes, 0.5 = 50% balanced front-rear. 
     84 
     85__sidewaysDriftFriction__ (0.0..1.0): amount of sideways grip the wheels loose when their forward slip exceeds their grip limit (gripRange+1). 0.0 = all grip lost, 0.5 = 50% grip lost, 1.0 = no grip lost. 
     86 
     87__staticFrictionMax__ (0..2500): sideways grip factor applied to the wheels at small sideways slip values. Increase this value when the car slides laterally in slopes. 0 to disable. 
     88 
     89__frontSidewaysGrip, rearSidewaysGrip__ (0.5..1.2): multipler of the grip factors for the front and rear wheels separately. Allows to fine tune the understeer / oversteer behaviors. 
     90 
     91## Additional & Experimental settings 
     92 
     93__serviceMode__: puts the script in Service Mode, which enables the raw friction curves without tweakings. Used with _CarTest_, these settings allows to retrieve the critical data from the friction curves, but has no utility in games. 
     94 
     95__airDrag__: influence of the aerodynamic drag calculated as Cdrag =  0.5 * Cd * A * rho. The value here is Cd*A. Use for establishing a limit for the vehicle's maximum speed. 
     96 
     97__frictionDrag__: a kind of mechanical and rolling friction, calculated as multipler of Cdrag (frictionDrag * Cdrag). The greater this value, the more time takes the vehicle to reach the maximum speed allowed by airDrag. 
     98 
     99__rollingFrictionSlip__ (0.01 - 0.1): braking slip in m/s applied to the wheels when moving inertially, without applying throttle or brakes. The greater this value, the quicker the vehicle comes to a stop when there's no throttle nor brake inputs. 
     100 
     101__tractionV3__: enables the experimental traction mode which reduces the traction slip applied to the drive wheels when approaching a predefined maximum speed (maxSpeed). At that value, no traction slip is applied. 
     102 
     103The old V2 traction model (by default) applies always the same traction slip regardless of the vehicle's speed, and relies only in the aerodynamic drag for limiting its speed. When using this V3 mode the aerodynamic drag can be set to a realistic value. 
     104 
     105__maxSpeed__ (m/s): maximum speed in m/s when using the _tractionV3_ mode. 
     106 
     107>__UPDATE:__ Due to the (in)famous WheelCollider bug, reducing the traction slip causes a major loss of sideways slip so the vehicle will likely go out of control. This is especially noticeable in fast vehicles (try enabling tractionV3 in the Sport Coupe). It's recommended NOT to use the _tractionV3_ option until a new version is released. Use _airDrag_ and _frictionDrag_ for setting the vehicle's acceleration and top speed. 
     108 
     109 
     110[1]: http://www.edy.es/unity/offroader.html 
     111 
     112}}}