This is pretty basic code, but I am a beginner for unity. when I assign this code to player ,which is just a 3d box, the player moving slow on y coordinate, why . Really appreciate someone’s help. This is my code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float spd = 100f;
public Rigidbody rb;
private float horizontal;
private float vertical;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
horizontal = Input.GetAxis("Horizontal") * spd;
vertical = Input.GetAxis("Vertical") * spd;
rb.velocity = new Vector3(horizontal , 0f, vertical) ;
}
}