//
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class move : MonoBehaviour
{
public float speed =5f;
private Rigidbody rb;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
if (Input.GetKey(KeyCode.W))
{
rb.AddForce(Vector3.forward * speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.S))
{
rb.AddForce(Vector3.back * speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.A))
{
rb.AddForce(Vector3.left * speed * Time.deltaTime);
}
if (Input.GetKey(KeyCode.D))
{
rb.AddForce(Vector3.right * speed * Time.deltaTime);
}
if (Input.GetKeyDown(KeyCode.W))
{
Debug.Log("W was pressed");
}
if (Input.GetKeyDown(KeyCode.D))
{
Debug.Log("D was pressed");
}
if (Input.GetKeyDown(KeyCode.S))
{
Debug.Log("S was pressed");
}
if (Input.GetKeyDown(KeyCode.A))
{
Debug.Log("A was pressed");
}
if (Input.GetKeyDown(KeyCode.Space))
{
Debug.Log("Space was pressed");
}