implementation of drecon in unity 2022 lts
forked from:
https://github.com/joanllobera/marathon-envs
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.
41 lines
759 B
41 lines
759 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class Rotate : MonoBehaviour
|
|
{
|
|
// Update is called once per frame
|
|
public float m_Speed;
|
|
private float m_X;
|
|
private float m_Y;
|
|
private float m_Z;
|
|
public enum Axis
|
|
{
|
|
X,
|
|
Y,
|
|
Z
|
|
}
|
|
|
|
public Axis m_Axis;
|
|
void Update()
|
|
{
|
|
float speed = -Time.fixedDeltaTime * m_Speed;
|
|
|
|
m_X = 0;
|
|
m_Y = 0;
|
|
m_Z = 0;
|
|
|
|
if (m_Axis == Axis.X)
|
|
{
|
|
m_X = speed;
|
|
} else if (m_Axis == Axis.Y)
|
|
{
|
|
m_Y = speed;
|
|
} else if (m_Axis == Axis.Z)
|
|
{
|
|
m_Z = speed;
|
|
}
|
|
|
|
this.transform.Rotate(m_X, m_Y, m_Z, Space.World);
|
|
}
|
|
}
|
|
|