2023-11-03 12:34:22 -04:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Sirenix.OdinInspector;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.XR.Content.Interaction;
|
|
|
|
|
|
|
|
public class RotateTarget : MonoBehaviour
|
|
|
|
{
|
|
|
|
[SerializeField] private Transform target;
|
|
|
|
|
|
|
|
[SerializeField] private float speed = 10f;
|
|
|
|
|
2023-11-14 13:38:38 -05:00
|
|
|
[SerializeField] private Vector3 rotationAxis = Vector3.right;
|
2023-11-03 12:34:22 -04:00
|
|
|
|
2023-11-14 13:38:38 -05:00
|
|
|
public void Rotate(float amount)
|
2023-11-03 12:34:22 -04:00
|
|
|
{
|
2023-11-14 13:38:38 -05:00
|
|
|
amount *= Time.deltaTime;
|
2023-11-14 11:51:12 -05:00
|
|
|
|
2023-11-14 13:38:38 -05:00
|
|
|
amount *= speed;
|
2023-11-14 11:51:12 -05:00
|
|
|
|
2023-11-14 13:38:38 -05:00
|
|
|
target.Rotate(rotationAxis,amount);
|
2023-11-14 11:51:12 -05:00
|
|
|
}
|
2023-11-03 12:34:22 -04:00
|
|
|
}
|