I am working on this:
public float animationTime = 3;
public AnimationCurve animationCurve = AnimationCurve.EaseInOut(0, 0, 1, 1);
private float time;
private bool isReset;
private float camY;
private OnlineMapsCameraOrbit cameraOrbit;
public void ButtonInteract()
{
camY = cameraOrbit.rotation.y;
isReset = true;
}
private void Start()
{
cameraOrbit = OnlineMapsCameraOrbit.instance;
}
private void Update()
{
if (!isReset) return;
time += Time.deltaTime;
float t = time / animationTime;
if (t >= 1)
{
// Reset values
time = 0;
isReset = false;
t = 1;
}
float f = animationCurve.Evaluate(t);
cameraOrbit.rotation.y = Mathf.Lerp(camY, -360 * 2, f);
}
The problem is that in this way I can only do 2 laps and I don't understand the behavior. I would like to spin the Chamber around its map center.