tranform position

how do you get the last known tranform position of an object. then set it to that position

In JavaScript you would make a variable that will "stick around" in-between updates. Then, you can set it to that whenever you want (meaning it won't move any more).

So, something like this might be what you want? Be aware, the following code was not tested but just typed-in here (expect missing semi-colons, etc):

----------somescript.js------------

private var lastPosition : Vector3;  // The last position.

public var bStayPut: boolean; // Public so you can change it while running in editor.

// Initialize in Start (or Awake):

function Start()
{
 lastPosition = transform.localPosition;
}

function Update()
{
 if (bStayPut)
  transform.localPosition = lastPosition; // Stay put.
 else
  {
  transform.localPosition.x += .01; // Move to the right, or whatever you want.
  lastPosition = transform.localPosition;
  }
}