Дополнен 3 месяца назад
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class player : MonoBehaviour
{
[Serializefield] KeyCode keyOne;
[Serializefield] KeyCode keyTwo;
[Serializefield] vektor3 moveDirection;
private void fixedUpdate()
{
if (Input.GetKey(keyOne))
{
GetComponent<Rigidbody>().velocity += moveDirection;
}
if (Input.GetKey(keyTwo))
{
GetComponent<Rigidbody>().velocity -= moveDirection;
}
}
}