- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
 
- 纳金币
- -1
- 精华
- 11
|
先看demo:
Demo:
http://www.edy.es/unity/Offroader.html/
![]()
Press Enter to restart the level (i.e. if you flip the car or fall outside the terrain)
Press C to change the secondary camera.
Press B to change the stability mode among "Sport / Offroad" (default is "Sport")
Press N to disable all stability features (keeps the plain rigidbody + 4 wheel colliders only). B to reenable.
It's not only a typical road-car not meant to being too stable, but it also carries a heavy 500 Kg (1100 lbs) box! Can you keep it safely with you in all kind of terrains?
Notes:
- Simple PhysX model: rigidbody + some box colliders roughly resembling the car's shape + 4 standard WheelColliders
- REAL center of mass, located around the front seats.
- No angular drag, no arbitrary forces.
- Default tyre friction curves, only stiffness is adjusted (forward: 0.82, sideways: 0.022)
- No parameter is modified at***ntime! (center of mass, rigidbody, drag or angular drag, suspension...)
---------------------------------------------------------------------------------------------------
This is the typical stability problem when using WheelColliders:
Q: Why my absolutely simple car (rigidbody + 4 wheel colliders) flips over so easily when steering?
A: Because that's exactly how such car would behave in real life!!
So you have created a box, added a rigidbody and four wheel colliders. Maybe you've even used some real car's data (mass, dimensions...). You have added a control script, tested it, and as soon as you gain a bit of speed and do a corner, the car rolls and flips over.
If you could build that in real life, it would do the same! PhysX is not perfect, but resembles the physical behavior of real objects in a fairly good manner.
Also note that the default WheelCollider's friction curve parameters in Unity (1,20000,2,10000,1) define a tyre with almost infinite grip. So the rigidbody has no choice but rolling-over when steering even at low speed. You should first set the last parameter (Stiffness Factor) to 0.01-0.03 to have more realistic tyres, but even in that case the car will roll over when stering at certain (low) speed.
Q: But real cars don't roll over so easily. Why?
A: Because real cars have STABILIZER BARS (aka anti-roll or anti-sway bars)
http://auto.howstuffworks.com/question432.htm
|
|