Rather simple two counter rotating hands, works in the editor fine as the video shows, but the camera rendering is getting quite confused, and rendering something different to the editor, I put side by side for comparison, it’s quite odd…
Or maybe my code is so terrible I’m wigging Unity out. 5.5.0.f3
using UnityEngine;
using System.Collections;
public class RotatArnd : MonoBehaviour
{
public float BPM = 120;
private float barDuration;
public float beatsInBar = 4;
private Transform thisCube;
private float angleDiv = 0;
private float spb = 0;
public bool reverse;
public bool flip;
public bool half;
private float counter;
private float barDur;
private float count;
void Start ()
{
thisCube = gameObject.transform;
Debug.Log (spb);
Debug.Log (angleDiv);
//counter = 0;
}
void Update ()
{
spb = (60 / BPM);
barDuration = spb * beatsInBar;
if (half) // If half is true go 180 round circle
{
barDur = barDuration / 2; // Half the length of bar
angleDiv = 360 / barDur;
count = angleDiv * Time.deltaTime / 2f; // keep same speed
} else // If not true go 360 round circle
{
barDur = barDuration;
angleDiv = 360 / barDur;
count = angleDiv * Time.deltaTime; // Giving inconsistent results with multiple objects, change to only looking at deltaTime once?
}
if (!reverse) // Reverses direction round circle
{
thisCube.Rotate (0, 0, -count);
} else
{
thisCube.Rotate (0, 0, count);
}
counter += Time.deltaTime; // counter counts bar length to see when to flip
Debug.Log ("Count your own time human..." + counter);
if (counter >= barDur)
{
counter = 0;
//Debug.Log ("mazin");
if (flip)
reverse = !reverse;
}
}
}
Damn my reflexes are making ctrl+ s this page every half a minute…