Hi, im struggling to add limits to a robotic arm I have made.
it moves using different buttons/ joysticks on a xbox controller.
I want to limit its movement so it doesn’t clash with walls etc, so I have tried to add that the position has to be below 10 on the z axis.
if (Input.GetAxis("XboxLeftJoystickX") > 0 && Gantry.gameObject.transform.position.z < 10) Gantry.gameObject.transform.Translate(Vector3.forward * 0.5f * Time.deltaTime);
but this doesn’t work, can anyone help, I just need to know the best way of limiting these movements.