I made a child for the player to rotate around, it works fine but the rotation resets when input has stopped. Here’s my code.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateChild : MonoBehaviour {
public Transform child;
private float rotSpeed = 5.0f;
// Update is called once per frame
void FixedUpdate () {
{
transform.LookAt (child);
}
{
if (Input.GetKey (KeyCode.RightArrow))
transform.RotateAround (Vector3.zero, Vector3.up, rotSpeed * Time.deltaTime);
}
{
if (Input.GetKey (KeyCode.LeftArrow))
transform.RotateAround (Vector3.zero, Vector3.down, rotSpeed * Time.deltaTime);
}
}
}