I’m making a first person freecam for my game but i cant figure out how to rotate it. my idea is to hold right click to rotate it around itself
here’s my current code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FreeCam : MonoBehaviour
{
void Update()
{
if (Input.GetKey(KeyCode.W))
{
gameObject.transform.position += transform.forward * 0.01f;
}
if (Input.GetKey(KeyCode.S))
{
gameObject.transform.position -= transform.forward * 0.01f;
}
if (Input.GetKey(KeyCode.E))
{
gameObject.transform.position += transform.up * 0.01f;
}
if (Input.GetKey(KeyCode.Q))
{
gameObject.transform.position -= transform.up * 0.01f;
}
if (Input.GetKey(KeyCode.A))
{
gameObject.transform.position -= transform.right * 0.01f;
}
if (Input.GetKey(KeyCode.D))
{
gameObject.transform.position += transform.right * 0.01f;
}
}
}
put the code under the camera btw