- Home /
Moving/rotating object with UI button help!!
Hello,I'm stuck with a problem, I'm very new to Unity game engine and CSharp Programming so take it easy on me, I've made a simple scene for presentation purposes in unity and I've used a simple script to move the camera around for a 3d menu and I have world space buttons, the question is I want to move or rotate certain objects when I click one of the UI buttons, I want to move them to a certain point in one of the directions, same goes with rotation plus I want the movement to be smooth, please bare in mind that I'm very new.
I am actually doing something very similar at the moment. It really depends on how you want them to move. if you want them to move to a particular position you would use transform.position = new Vector3(float, float, float);
if you want them to move in a particular direction you would do transform.Translate(Vector3.right, Time.deltaTime); //assu$$anonymous$$g you wanted it to move right. then to stop it you would have something like if (transform.position.x >=3) { transfrom.position = new Vector3(3, 0, 0); }
hope this helped!