movement with the W key
This commit is contained in:
parent
340edf6d6f
commit
ec658080c6
|
@ -4,6 +4,11 @@ using UnityEngine;
|
||||||
|
|
||||||
public class PlayerMovement : MonoBehaviour
|
public class PlayerMovement : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
|
||||||
|
public Rigidbody rb;
|
||||||
|
|
||||||
|
public float forwardForce = 1000f;
|
||||||
|
|
||||||
// Start is called before the first frame update
|
// Start is called before the first frame update
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
@ -11,8 +16,10 @@ public class PlayerMovement : MonoBehaviour
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void FixedUpdate()
|
||||||
{
|
{
|
||||||
|
if (Input.GetKey("W")) {
|
||||||
|
rb.AddForce(forwardForce * Time.deltaTime, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue