So I’m struggling with a the idea of how to go about creating my controller for my latest project where I have the mouse controlling the camera’s orbit around the player. But I want my characters controls with both horizontal and vertical to be based off the current orientation. The problem is I’m having a super brain fart on this and not coming up with anything. I started a basic code like so:
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
float moveSpeed = 2f;
void Update()
{
transform.Translate (new Vector3 (Input.GetAxis("Horizontal")*moveSpeed*Time.deltaTime, 0, Input.GetAxis("Vertical")*moveSpeed*Time.deltaTime));
}
}
This obviously is just getting the movements of the player but on a basic local axis. So what I’m thinking I need to do is do this based off the camera’s axis instead. But not really sure how to go about it.