You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
472 B

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class WheelController : MonoBehaviour {
  5. public Vector3 rotateDirection;
  6. public float rotateSpeed;
  7. public bool isRotating;
  8. void Update ()
  9. {
  10. if(isRotating)
  11. {
  12. //Rotate the selected wheel in the direction
  13. //chosen at rotateSpeed Speed
  14. //if isRotating is checked in the inspector.
  15. transform.Rotate(rotateDirection * rotateSpeed * Time.deltaTime);
  16. }
  17. }
  18. }