how do i move forward based on where i’m looking using the “w” key ?
using UnityEngine;
public class Player1Movement : MonoBehaviour
{
public Transform tf;
public Rigidbody rb;
public float ForwardForce = 700;
public float SideWaysForce = 700;
// Update is called once per frame
void Update()
{
if (Input.GetKey("w"))
{
rb.AddForce(0, 0, ForwardForce * Time.deltaTime);
}
if (Input.GetKey("s"))
{
rb.AddForce(0, 0, -ForwardForce * Time.deltaTime);
}
}
}