Unity 製作賽車遊戲常用的 component 變得方便許多了,以前都是要經過計算及動畫來表現。
Unity wheel collider component 圖示:
功能說明:
English :
Mass | The Mass of the wheel. |
Radius | Radius of the wheel. |
Wheel Damping Rate | This is a value of damping applied to a wheel. |
Suspension Distance | Maximum extension distance of wheel suspension, measured in local space. Suspension always extends downwards through the local Y-axis. |
Force App Point Distance | This parameter defines the point where the wheel forces will applied. This is expected to be in metres from the base of the wheel at rest position along the suspension travel direction. When forceAppPointDistance = 0 the forces will be applied at the wheel base at rest. A better vehicle would have forces applied slightly below the vehicle centre of mass. |
Center | Center of the wheel in object local space. |
Suspension Spring | The suspension attempts to reach a Target Position by adding spring and damping forces. |
Spring | Spring force attempts to reach the Target Position. A larger value makes the suspension reach the Target Position faster. |
Damper | Dampens the suspension velocity. A larger value makes the Suspension Spring move slower. |
Target Position | 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. |
Forward/Sideways Friction | Properties of tire friction when the wheel is rolling forward and sideways. See the Wheel Friction Curves section below. |
質量 | 車輪的質量。 |
半徑 | 半徑的車輪。 |
滾輪阻尼率 | 這是阻尼施加到車輪的值。 |
懸掛距離 | 車輪懸架的最大延伸距離,在本地空間測量。懸浮液總是通過本地Y軸向下延伸。 |
力應用點距離 | 此參數定義了輪子上的力會作用點。這是預期要在米從輪的基部沿懸架行程方向靜止位置。當力任命距離=0的力將在休息時的軸距被應用。一個更好的車輛將有力量施加略低於大眾的車輛中心。 |
中央 | 車輪在對象的局部空間的中心。 |
懸架彈簧 | 將懸浮試圖通過增加彈簧和阻尼力將達到一個目標位置。 |
彈簧 | 彈簧力試圖到達目標位置。較大的值使懸架到達目標位置更快。 |
避震 | 減震器懸浮速度。較大的值,使懸架彈簧移動速度較慢。 |
目標位置 | 該懸掛其餘的距離沿懸架距離。 0映射到完全伸展懸浮液中,和1映射到完全壓縮懸浮液。默認值是零,其匹配常規汽車的懸架的行為。 |
前進 側身摩擦 | 輪胎摩擦的性質時,車輪滾滾向前和側面。請參閱下面的車輪摩擦曲線部分。 |
The Wheel Collider Component. Car model courtesy of ATI Technologies Inc.
該輪對撞機的組成部分。
Details :
The wheel’s collision detection is performed by casting a ray from Center downwards through the local Y-axis. The wheel has a Radius and can extend downwards according to the Suspension Distance. The vehicle is controlled from scripting using different properties:motorTorque, brakeTorque and steerAngle. See the Wheel Collider scripting reference for more information.
The Wheel Collider computes friction separately from the rest of physics engine, using a slip-based friction model. This allows for more realistic behaviour but also causes Wheel Colliders to ignore standard Physic Material settings.
由向下通過局部Y軸鑄造從中心射線進行車輪的碰撞檢測。該輪具有半徑,並且可以根據懸架距離向下延伸。制動力矩和轉向角:車輛從腳本使用不同的屬性控制。更多信息請參見該輪胎碰撞器腳本參考。
該輪對撞機分開計算摩擦力的物理引擎的其餘部分,採用了防滑基於摩擦模型。這樣就可以更真實的行為,而且會導致車輪撞機忽略標準物理學材質設置。
Wheel collider setup:
You do not turn or roll WheelCollider objects to control the car - the objects that have the WheelCollider attached should always be fixed relative to the car itself. However, you might want to turn and roll the graphical wheel representations. The best way to do this is to setup separate objects for Wheel Colliders and visible wheels:
你不轉或滾動WheelCollider對象來控制汽車 - 具有連接的WheelCollider應始終相對於汽車本身固定的對象。但是,您可能要轉向和滾動圖形車輪表示。
※ 但是以我的經驗來看的話:
每一個美術工程師在建立3D模型的中心有所不同,所以建議先建立一個空物件,在空物件底下建立子物件再加入輪胎碰撞器的組件(wheel collider component),這樣才能有效的控制。
Note that the gizmo graphic for the WheelCollider’s position is not updated in playmode:
Collision geometry
Because cars can achieve large velocities, getting race track collision geometry right is very important. Specifically, the collision mesh should not have small bumps or dents that make up the visible models (e.g. fence poles). Usually a collision mesh for the race track is made separately from the visible mesh, making the collision mesh as smooth as possible. It also should not have thin objects - if you have a thin track border, make it wider in a collision mesh (or completely remove the other side if the car can never go there).
碰撞幾何
因為汽車可以實現較大的速度,讓賽道碰撞幾何權是非常重要的。具體地,碰撞網格不應有小的凸起或凹陷構成可見模型(例如柵欄極)。一般碰撞網格為賽道分開可見網格製成,使得碰撞網眼盡可能平滑。它也應該不會有薄的對象 - 如果你有一個薄的軌道邊界,使其在碰撞網格較寬(或完全刪除對方如果汽車不能去那裡)。
Property: | Function: |
---|---|
Extremum Slip/Value | Curve’s extremum point. |
Asymptote Slip/Value | Curve’s asymptote point. |
Stiffness | Multiplier for the Extremum Value and Asymptote Value (default is 1). Changes the stiffness of the friction. Setting this to zero will completely disable all friction from the wheel. Usually you modify stiffness at runtime to simulate various ground materials from scripting. |
屬: | 方法: |
---|---|
極值滑/值 | 曲線的極值點。 |
漸近線滑動/值 | 曲線的漸近線點。 |
剛性 | 乘數的極值和漸近值(默認為1)。改變了摩擦的剛度。這個設置為零將完全禁用來自車輪的所有摩擦。通常你修改剛度在運行時模擬從腳本各種地面材料. |
Hints
- You might want to decrease physics timestep length in Time Manager to get more stable car physics, especially if it’s a racing car that can achieve high velocities.
- To keep a car from flipping over too easily you can lower its Rigidbody center of mass a bit from script, and apply “down pressure” force that depends on car velocity.
提示
- 您可能要減少物理時間步長的時間管理以獲得更穩定的汽車物理,尤其是如果它是一輛賽車,可以實現較高的速度。
- 保持車子的翻轉過也很容易就可以降低其剛體質心一點從劇本,並應用依賴於汽車的速度“下壓”的力量。
資料來源: http://docs.unity3d.com/Manual/class-WheelCollider.html
沒有留言:
張貼留言