Hi
First time posting on the forum after getting nowhere looking at how to rotate my wheels on the car!
I have searched the forum and youtube to try and get results but nothing seems to be working, so hopefully somebody can help me out!
I have got my car to move using the arrow keys although when moving to fast and turn the car flips over (another question for later)
This is my setup:
1387144β71046β$Wheels.bmp (64.8 KB)
On each of the wheels I have added a wheel collider,
In my car controller script I state my variables:
public Transform wheelFLTrans;
public Transform wheelFRTrans;
public Transform wheelBRTrans;
public Transform wheelBLTrans;
Then in the update method try and rotate:
void update()
{
wheelFLTrans.Rotate(Vector3.right * wheelFL.rpm * 2 * Mathf.PI / 60.0f * Time.deltaTime * Mathf.Rad2Deg );
wheelFRTrans.Rotate(Vector3.right * wheelFR.rpm * 2 * Mathf.PI / 60.0f * Time.deltaTime * Mathf.Rad2Deg );
wheelBRTrans.Rotate(Vector3.right * wheelBR.rpm * 2 * Mathf.PI / 60.0f * Time.deltaTime * Mathf.Rad2Deg );
wheelBLTrans.Rotate(Vector3.right * wheelBL.rpm * 2 * Mathf.PI / 60.0f * Time.deltaTime * Mathf.Rad2Deg );
}
1387144β71047β$Car.bmp (379 KB)
I followed a youtube video (not sure if allowed to post links) and this is exactly the setup but my wheels donβt rotate, the only thing different is I downloaded this model from unity assets store!
Please I hope somebody can help me out, thanks in advance!