unity 3d first person movement script code example
Example: unity 3d first person movement look around
public Rigidbody rb;
public float MouseSensitivity;
public float MoveSpeed;
public float JumpForce;
void Start ()
{
}
void Update()
{
rb.MoveRotation(rb.rotation * Quaternion.Euler(new Vector3(0, Input.GetAxis("Mouse X") * MouseSensitivity, 0)));
rb.MovePosition(transform.position + (transform.forward * Input.GetAxis("Vertical") * MoveSpeed) + (transform.right * Input.GetAxis("Horizontal") * MoveSpeed));
if (Input.GetKeyDown("space"))
rb.AddForce(transform.up * JumpForce);
}