transform.position question

Hi guys. :slight_smile:
my question is: how can I do for move a transverse object Up and Down with transform position? i posted a pic. This way is wrong? It’s convenient make the object straight and after change its position?

#pragma strict

public var GameObject : Pistone;

function Update () {

if(Input.GetKeyDown(KeyCode.A)) {
Pistone.transform.position = Vector3(0,0,0);
}

}

Assuming the object is a child of the rod, and that you aligned the two before the whole thing is rotated, you can just use Transform.localPosition for the movement. Alternately, you can use Transform.Translate(). Translate() uses local coordinates by default.