x


wheels are not rotating on their own axis

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

more ▼

asked Dec 08 '11 at 08:51 AM

Christophoros123 gravatar image

Christophoros123
16 1 1 1

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

void Rotate(Vector3 axis, float angle, Space relativeTo);
Either "axis" is wrong, or you should use "Space.Self" for "relativeTo". That's all i can tell from what little info you gave.

more ▼

answered Dec 08 '11 at 09:04 AM

ks13 gravatar image

ks13
264 13 15 17

(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Dec 08 '11 at 09:05 AM

aldonaletto gravatar image

aldonaletto
41.2k 16 42 195

(comments are locked)
10|3000 characters needed characters left

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.
In the first case the only way i know of is to edit the object to change it's center in a program like 3DSMax, or Blender.
In the second case, use Space.Self as the third parameter in your rotate. By default it's Space.Self, but it may have a bug if it uses the parent object'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.

more ▼

answered Dec 08 '11 at 09:31 AM

ks13 gravatar image

ks13
264 13 15 17

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2155
x62

asked: Dec 08 '11 at 08:51 AM

Seen: 1556 times

Last Updated: Dec 08 '11 at 01:34 PM