Wheelcollider Summary
Wrote the first two articles, I would like to summarize the wheelcollider!
So that we can learn more clearly the development of physical vehicles!
1. The car's hierarchy
In general, the body, the body's bounding box, four wheels and four-wheel collider!
2. Analysis of the principle of driving car
The owner of the body added a rigidbody, the physical car we can add one to two bounding box to
Wrap the body (but never cover the wheels, otherwise the physical car doesn't move!) The physical car has four wheels, then some cars need front wheel drive, rear wheel to assist, some cars need rear wheel to drive, front wheel to assist! This is very good, if it is which
Wheel is driven, the wheelcollider.motortorque of the wheel is set, i.e. the wheel
Power, Wheelcollider.steerangle, set the rotation angle of the wheel, so that the basic OK
, how does the wheel walk with the undulating ground? That's another question!
about how to keep the wheels on top of the ground and to move with the ups and downs of the ground?
A ray can be emitted from the wheel collider (Wheelcollider) to the ground, with Physics.raycast to obtain a raycasthit, to obtain a collision point, to adjust the position of the wheel,
Here is a supplement to Wheelcollider's properties, a copy of the http://game.ceeger.com/Components/class-WheelCollider.html fragment!
Properties Property
- Center Centre of the wheel in object local space. The center position of the wheel in the object's own coordinates
- Radius radius of radius of the wheel. radius size of the wheel
- Suspension Distance Suspension distance Maximum extension Distance of wheel suspension, measured in local space. Suspension always extends downwards through the local y-axis. Maximum wheel suspension telescopic distance, calculated in its own coordinates. The suspension always stretches downward through its own y-axis.
- Suspension Spring Suspension Spring The suspension attempts to reach a Target Position by adding spring and damping forces. by adding a spring and damping force, the suspension attempts to reach the target position (Position).
- Spring Springs Spring Force attempts to reach the Target Position. A larger value makes the suspension reach the Target Position faster. The spring force attempts to reach the target location (target Position), and the large value allows the suspension to reach the target position quickly (targets Position).
- Damper Damper dampens the suspension velocity. A larger value makes the suspension Spring move slower. The damper controls the suspension speed and the large value allows the suspension spring to move slower.
- Target Position Destination location The suspension ' s rest distance along suspension distance. 0 maps to fully extended suspension, and 1 maps to fully compressed suspension. Default value is zero, which matches the behavior of a regular car ' s suspension. suspension of the static state distance along the hanging distance, 0 values fully stretched suspension, 1 value fully compressed suspension, the default value is 0, which is a standard car suspension behavior
- Mass Quality The Mass of the wheel. the quality of the wheels
- Forward/sideways friction forward friction Properties of tire friction when the wheel is rolling Forward and sideways. See Wheel friction Curves section below. Friction Properties when the wheel is rolling forward/sideways. See the wheel Friction curve section below.
For the physical car to write here, later understand the deeper, continue to write ...
Below I have the physics, the Rigidbody, as well as "the joint" the separate to do a tutorial, hehe ...!
Unity--------------------------Summary of Wheelcollider and trolley experiments