The GR car physics is based on a mix of "sphere collider" and wheel raycasting to enable a very customizable physics model for different kind of vehicles.
Mesh (Visual part)
The following structure is predefined and very import for a user-based 3d model.
--- 3DModelName (root element)
--- Visuals (child root element for meshes)
--- Body (Full BodyMesh)
--- WheelBackLeft (Back left wheel mesh)
--- WheelBackRight (Back right wheel mesh)
--- WheelFrontLeft (Front left wheel mesh)
--- WheelFrontRight (Front right wheel mesh)
You have to exactly follow this structure and rules to make it work ingame:
- In frontview of the 3d-model both front wheels must perfectly aligned with the surface
- In sideview of the 3d-model both front and rear wheels must perfectly aligned with the surface
- The origin of the "body" element must be placed in the middle(sideview) / middle (frontview) of the carcenter, directly on the surface
- The origin of each "wheel" element must be plcaed in the middle (sideview) / middle (topview) of the wheelcenter
The saved main scale of all elements (from first to last) must be set to Scale. 1.000 and should fit to the world-related dimension. Means: Scale it first to a perfect relation of the world, then set the apply the scale to value 1.
Physic (Physics Part)
A formula one car is ready and waiting for implimenation.
SmoothStep Value means a interpolation of the "steering" speed to change from linear to a curve like that:
The smooth factor is the value for the "time" axe.
Physics Panel (Car Settings)
Button Key 'm' is used to show/hide this panel of car settings.
- MaxAccel: Set the rate of acceleration of the vehicle. Higher values will make the vehicle accelerate faster.
- Maxspeed: Set the top speed of the vehicle. Higher values will make the vehicle run faster.
- BrakeStrength: Set the hardness of the brake. Higher values will make the vehicle stop faster.
- SlopeFriction: Set the resistance level in slopes. Higher values will make the car move slower in rising or falling surfaces.
- MaxSteering: Set the level of steering. Higher values will make the vehicle turn faster.
- SmoothFactor: Set the factor level of smooth steering. Higher values will provide a jerk-free movement of the vehicle.
- SmoothSteering: Set smooth steering to on or off. On (1) means enable smooth steering and off (2) means disable smooth steering.
- ForwardFriction: Set the level of resistance in relation to the thrust (driving) force. Higher values will slow down/brake more the vehicle when driving.
- LateralFriction: Set the level of resistance in relation to lateral forces. Higher values will allow more grip when taking corners.
- SideFriction: This value adjust the side friction if the car hits an object (except the existing physic material values and behaviours!)
- BodyMass: Set the total mass of the vehicle. Higher values means the vehicle weights more and will effect acceleration, speed and impact with objects.
- GravityVelocity: Set the gravitional pull of the vehicle. Higher values will reduce the vehicle's velocity.
- MaxGravity: Set the gravitational pull level. Higher values effects the car when driving, especially downhill or uphill in terms of speed, acceleration, braking and steering.
Surface Behaviours and Settings
The car is detecting the appropriate surface under the chassis. The detecting point is exactly in the middle of the car and read out a block of area around this middle point to prevent small pixel deviations.
All colors around the middlepoint will be summarized to a average color to find the "closest" color to define which terrain is detected under the car currently.
The detected surface will adjust the physic values with multipliers for each defined terrain.
At the beginning just one car is available to test different surfaces, physics-settings, behaviours and all things around.