unity move in direction code example
Example 1: move in the direction that player is facing unity
float movementSpeed = 100f;
void Update()
{
rb.GetComponent<Rigidbody>().velocity = transform.forward * Time.deltaTime * movementSpeed;
}
Example 2: how to move in move direction in unity
transform.position += transform.forward * Time.deltaTime * movementSpeed;