# Wheel rotation

Can someone explain me this script? It does rotate wheel texture but i don’t understand it.

I don’t understand following part of the script.

    wheels[0].Rotate(getCollider(0).rpm, 0 / 60 * 360 * Time.deltaTime, 0);
wheels[1].Rotate(getCollider(1).rpm, 0 / 60 * 360 * Time.deltaTime, 0);

using UnityEngine;
using System.Collections;

public class control_moped : MonoBehaviour
{

public Transform[] wheels;
}
void FixedUpdate()
{
wheels[0].Rotate(getCollider(0).rpm, 0 / 60 * 360 * Time.deltaTime, 0);
wheels[1].Rotate(getCollider(1).rpm, 0 / 60 * 360 * Time.deltaTime, 0);
}
}


There is a lot of useless math there.

wheels[0].Rotate(getCollider(0).rpm, 0 / 60 * 360 * Time.deltaTime, 0);
wheels[1].Rotate(getCollider(1).rpm, 0 / 60 * 360 * Time.deltaTime, 0);


can be simplified as:

wheels[0].Rotate(getCollider(0).rpm, 0, 0);
wheels[1].Rotate(getCollider(1).rpm, 0, 0);


Then, you just need to check the docs to figure out what is going on.

WheelCollider.rpm

Transform.Rotate(float xAngle, float yAngle, float zAngle)

Essentially, the wheel’s xRotation is incremented by the wheel’s rpm each time this is called.

I need some help with mecanum wheel colliders- Might you be able to point me in the right direction.

Is there a set of equations for calculating motion when only two mecanum wheels are touching, i.e. when the robot moves over a bump and gets lifted up a bit.

Then we can use the wheel colliders to determine grounded-ness and change the force vectors based on how many wheels are touching

Note It is computationally intensive to accurately simulate true mecanum wheel friction / torque. Instead we calculate the motion and apply the force to the whole robot.