using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
public Rigidbody rb;
public float strafeSpeed = 500f;
public float runSpeed = 500f;
public float jumpForce = 15f;
protected bool strafeleft = false;
protected bool strafeRight = false;
protected bool doJump = false;
void Update()
{
If(Input.GetKey("a"))
{
strafeleft = true;
} else
{
strafeleft = false;
}
If(Input.GetKey("d"))
{
strafeRight = true;
} else
{
strafeRight = false;
}
If(Input.GetKeyDown("space"))
{
doJump = true;
}
}
Void FixedUpdate()
{
rb.AddForce(0, 0, runSpeed * Time.deltaTime);
}
(else выделено красным, код писал в sublime text)