How to define a position local to an object?


I want to define a position which is 10 units along an object's x-axis. The following sets the position along the world x-axis, how to I modify it for the object axis?

var newPosition : Vector3;
newPosition = myCube.transform.position;
newPosition.x += 10.0;

(I'm not trying to move myCube, I want to instantiate something at the new position)



TransformDirection is a handy function to change a local offset into a world offset:

myCube.transform.position = myCube.transform.position + myCube.transform.TransformDirection(Vector3(10, 0, 0));

myCube.transform.position = myCube.transform.position + new Vector3(10, 0, 0);

should do it.