using Northbound; using UnityEngine; [RequireComponent(typeof(Rigidbody))] public class PlayerController : MonoBehaviour { [Header("Movement Settings")] [SerializeField] private float moveSpeed = 5f; private Rigidbody rb; private Vector3 moveDirection; private PlayerInteraction playerInteraction; void Start() { rb = GetComponent(); rb.constraints = RigidbodyConstraints.FreezeRotation; playerInteraction = GetComponent(); } void Update() { if (playerInteraction != null && playerInteraction.IsInteracting) return; float horizontal = Input.GetAxisRaw("Horizontal"); float vertical = Input.GetAxisRaw("Vertical"); moveDirection = new Vector3(horizontal, 0f, vertical).normalized; } void FixedUpdate() { rb.linearVelocity = new Vector3( moveDirection.x * moveSpeed, rb.linearVelocity.y, moveDirection.z * moveSpeed ); } }