Moving on Axis

I know how to move some thing on its axis by:

var thisVar : int;
function Update () {

transform.position.x -= thisVar * Time.deltaTime;
}

but I don’t know how to make it move a certain distance and go on forever. If it isn’t clear, I’m sorry. thats the best I can explain it.

are you wanting physics based or transform based

physics allows collisions and stuff but uses forces applied.
transform doesnt allow collisions it teleports to a point.

physics
attach a rigidbody to the object

gameobject.rigidbody.addforce(direction * speed)

to find the direction to something

direction = wheretogo.transform.position - whatsgoingthere.transform.position;
you do not multiple by time.deltatime in that case
you simply force and then let it die off.
if you’d like something to go at a constant speed you can set its velocity
setting velocity doesn’t look realistic because it isn’t. its a constant rate and set by you not the laws of physics.

gameobject.rigidbody.velocity(direction * speed)
if you change the velocity it will immediatly affect the object
for example if it was going up 100miles an hour
change velocity 1mph down
instantly going 1mph down.

if its going 100mph up
addforce 1mph down
it changes velocity by 1mph in the donw
its going 99mph up

transform.MovePosition(direction.normalized * speed)
that teleports the object to that position so that the center of the object is at that point.

.normalized changes the direction to a length of 1.
that means its basically going 1 unit left/right/up/down or 1 unit towards whatever unique direction your going towards.

need any more help?