This commit is contained in:
2021-07-22 16:52:00 +02:00
parent b1dad755b6
commit 2168955a99
4 changed files with 331 additions and 30 deletions

View File

@@ -21,15 +21,13 @@ public class RotateAroundSelfAxis : MonoBehaviour
// Update is called once per frame
void Update()
{
rotation = transform.rotation;
if(right_rotation) {
rotation[2] -= speed * Time.deltaTime;
transform.localRotation *= Quaternion.AngleAxis(speed * Time.deltaTime, new Vector3(0f, 0f, -1f));
} else {
rotation[2] += speed * Time.deltaTime;
transform.localRotation *= Quaternion.AngleAxis(speed * Time.deltaTime, new Vector3(0f, 0f, 1f));
}
Debug.Log(speed * Time.deltaTime);
transform.rotation = rotation;
Debug.Log(rotation[2]);
}
}

View File

@@ -10,8 +10,8 @@ public class Rotation : MonoBehaviour
public bool static_center = true;
public bool right_rotation = true;
public bool flipping = false;
[Range(0.1f, 8)] [SerializeField] private float speed = 1;
[Range(0, (float)Math.PI * 2)] [SerializeField] private float flip_angle = 0;
[Range(0.1f, 8)] public float speed = 1;
[Range(0, (float)Math.PI * 2)] public float flip_angle = 0;
private float angle;
private float magnitude;