|
flWheel.Rotate(leftWheel.rpm / 60 * 360 * Time.deltaTime, 0,0); I am using the aboce script, in order to make the wheel rotate. However, what happens, if that the wheel is not rotating around its axis. the wheel rotates and takes a circular direction around the car,instead on its own. Thanks
(comments are locked)
|
|
void Rotate(Vector3 axis, float angle, Space relativeTo);
(comments are locked)
|
|
The wheel pivot isn't in the flWheel center! In the Scene view, click the moving tool and the wheel: the axes gizmo will appear in the point the wheel is rotating around, not in the wheel's center. This can happen if the wheel model was created not centered in the 0,0,0 position in some modeling softwares - return to this program and fix the pivot position. Another cause can be in Unity: if flWheel is an object which contains the wheel model, the model may be out of center.
(comments are locked)
|
|
If the wheel is rotating around the car then either the object's center is not where it should be, or it uses the parent's center. Edit : i just remembered there's a RotateAround method. It allows you to specify a pivot point. You should be able to, in worst case, add an empty GameObject, to use it as the pivot.
(comments are locked)
|
