Wheel Animation

Can you animate car wheels in unity or do you have to use Maya to animate then import the wheel rotation?

read this:

1 Like

No problem. Have fun … :slight_smile:

You can animate for free! in BLENDER and export as an FBX file, import to Unity as LEGACY setup an animation called ‘spin’ then use the wheelCollider.rpm to set ‘spin’ speed using script below:

#pragma strict

var wheels : WheelCollider;
var wspeed : float;
function Start () {

}

function FixedUpdate () {
wspeed = wheels.rpm * (360/60) * Time.deltaTime;
animation[“spin”].speed = wspeed;
if(Input.GetAxis(“Vertical”))
{
animation.Play(“spin”);
}
}

attach this script to the wheel mesh objects and reference each corresponding wheel collider by dragging appropriate collider into each script for each wheel…

Hope this is helpful for someone =)

note: you dont have to use the wspeed var, i put it in there so i could see the variable change in inspector.

1 Like