The problem started when I started using transform.Translate and Space.Self to make the player move relative to its own axis, rather than globally. I have no clue what the problem is now, it just goes in random directions now.
This is the main movement script in question:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Movement : MonoBehaviour
{
public float playerMovementSpeed = 1f;
private float gravity = -9.1f; // dw about this, ended up not using it
[SerializeField] private float gravityMultiplier = 1f; // dw about this, ended up not using it
private float velocity; // dw about this, ended up not using it
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKey(KeyCode.W)) {
transform.Translate(transform.forward * Time.deltaTime * playerMovementSpeed, Space.Self);
}
if (Input.GetKey(KeyCode.A)) {
transform.Translate(-transform.right * Time.deltaTime * playerMovementSpeed, Space.Self);
}
if (Input.GetKey(KeyCode.S)) {
transform.Translate(-transform.forward * Time.deltaTime * playerMovementSpeed, Space.Self);
}
if (Input.GetKey(KeyCode.D)) {
transform.Translate(transform.right * Time.deltaTime * playerMovementSpeed, Space.Self);;
}
}
}
The camera movement was done in a separate script, nothing’s wrong with it.
There aren’t any errors in the console.
Lmk if you need any more information.