*
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SimpleSuspension : Suspension {
|
||||
private Quaternion _startupRotation;
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
_startupRotation = transform.localRotation;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
public override void OnSteerChanged()
|
||||
{
|
||||
transform.localRotation = _startupRotation * Quaternion.AngleAxis((float)Steer, Vector3.up);
|
||||
}
|
||||
|
||||
void OnDrawGizmos(){
|
||||
var up = transform.up;
|
||||
var center = transform.position;
|
||||
Gizmos.DrawLine(center + up * (float)((1.0 - suspensionTarget) * travelDistance), center - up * (float)(suspensionTarget* travelDistance));
|
||||
|
||||
bool front = wheel.name[wheel.name.Length - 2] == 'f';
|
||||
Vector3 vOffset = front ? Vector3.up : Vector3.up * 0.5f;
|
||||
|
||||
Gizmos.DrawLine(dbgWheelForcePos + vOffset, dbgWheelForcePos + dbgWheelForce + vOffset);
|
||||
|
||||
Gizmos.DrawLine(dbgWheelForcePos + vOffset, dbgWheelForcePos);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user