Game Development Reference
In-Depth Information
58.
Vector3 wheelPosition = transform.position;
59.
wheelPosition.y = colliderCenter;
60.
transform.position = wheelPosition;
61.
} else {
62.
//No hit, smoothly return wheel to its original position
63.
Vector3 pos = transform.localPosition;
64.
pos = Vector3.Lerp(transform.localPosition,
65.
originalPos, Time.deltaTime);
66.
transform.localPosition = pos;
67.
}
68.
}
69.}
Listing 46: A script to animate the visual wheels based on the properties of the wheel colliders
Search WWH ::




Custom Search