Hi, I am new to Unity and trying to learn while making a basic game.
I am trying to put controls to a cube that is going to fall from high to a platform and bounce back. Basically the player is going to try keeping it within the boundaries of the platform.
I used the basic controller for the player but it seems like my cube moving only on X and Y axes, instead of X and Z. I don’t want the player to control the cubes falling or moving upwards since it already has a rigidbody attached. How can I make it move only on XZ? Thanks.
void Update()
{
float Horz = Input.GetAxis("Horizontal");
float Vert = Input.GetAxis("Vertical");
transform.position = transform.position + new Vector3(Horz * MoveSpeed * Time.deltaTime, Vert * MoveSpeed * Time.deltaTime, 0);
}