Jak przesuwać obiekt za pomocą klawiatury w Unity 3D
public class realguymoves : MonoBehaviour //the class of object
{
//movement
float speed;
float horizontal;
float vertical;
Vector3 moveDirecion;
float drag;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
horizontal = Input.GetAxisRaw("Horizontal"); //getting the horizontal axis of the object
vertical = Input.GetAxisRaw("Vertical"); //getting the vectical axis of the object
moveDirecion = transform.forward * vertical + transform.right * horizontal;
}
Inquisitive Iguana