using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rotation : MonoBehaviour
{
public float rotationSpeed = 100f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
gameObject.transform.RotateAround(new Vector3(0,0,1f),rotationSpeed*Time.deltaTime*0.2f);
}
}
,I want to put this object to sleep and the rotation will not start unless the player approaches it with a certain distance
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rotation : MonoBehaviour
{
public float rotationSpeed = 100f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
gameObject.transform.RotateAround(new Vector3(0,0,1f),rotationSpeed*Time.deltaTime*0.2f);
}
}