Move Object 1m to left or right

Looking for a simple script to move an object left, right, up, down... at the click of a button.

Button 1 moves an object 1 meter to right.
Button 2 moves an object 1 meter to left.
Button 3 moves an object 1 meter up.
Button 4 moves an object 1 meter down.

When I am in Plan View or Front View I like to move stuff out of the way and then move it back perfectly into position without messing around keying digits in.

Hope someone can help.

Comments

adamwiler's picture

Nice Post

Well, you can try using below script and let me know if it works or not

[public class CubeMove : MonoBehaviour {
public float moveSpeed = 3f;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update ()
{
//Moves Forward and back along z axis //Up/Down
transform.Translate(Vector3.forward * Time.deltaTime * Input.GetAxis("Vertical")* moveSpeed);
//Moves Left and right along x Axis //Left/Right
transform.Translate(Vector3.right * Time.deltaTime * Input.GetAxis("Horizontal")* moveSpeed);
}
}/CODE]

You can get in contact with me on my website.