movement with the W key

This commit is contained in:
logzinga 2023-02-10 10:54:54 +11:00
parent 340edf6d6f
commit ec658080c6
1 changed files with 9 additions and 2 deletions

View File

@ -4,6 +4,11 @@ using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public Rigidbody rb;
public float forwardForce = 1000f;
// Start is called before the first frame update
void Start()
{
@ -11,8 +16,10 @@ public class PlayerMovement : MonoBehaviour
}
// Update is called once per frame
void Update()
void FixedUpdate()
{
if (Input.GetKey("W")) {
rb.AddForce(forwardForce * Time.deltaTime, 0, 0);
}
}
}