RotateGameObject.cs 543 B

1234567891011121314151617181920212223
  1. using UnityEngine;
  2. using System.Collections;
  3. public class RotateGameObject : MonoBehaviour {
  4. public float rot_speed_x=0;
  5. public float rot_speed_y=0;
  6. public float rot_speed_z=0;
  7. public bool local=false;
  8. // Use this for initialization
  9. void Start () {
  10. }
  11. // Update is called once per frame
  12. void FixedUpdate () {
  13. if (local) {
  14. transform.RotateAroundLocal(transform.up, Time.fixedDeltaTime*rot_speed_x);
  15. } else {
  16. transform.Rotate(Time.fixedDeltaTime*new Vector3(rot_speed_x,rot_speed_y,rot_speed_z), Space.World);
  17. }
  18. }
  19. }