How would I declare a variable that stores starting position of a GameObject?

I’m trying to make a 2D platformer where a GameObject mirrors the player. (New to programming - artist)

I’m trying to declare a variable to store the starting position of the player, and then I have to declare a variable that stores any offset position from the starting position. Then, I need to declare a variable to store the starting position of the GameObject. Finally, I have to negate the offset position of the player from the starting position of the GameObject (for a mirroring effect).

Is there any easier way? Am I doing something wrong? Here’s my attempt at making the first script to put on the player (stores the starting position and the offset position). Sorry if it is bad, like I said, I’m pretty new to programming.

This is what I have:

var initialPosition : Vector3;
var offsetPosition : float;

function Start()
{
	initialPosition = transform.position
}

function Update()
{
	offsetPosition = initialPosition - (what should I put here??)

EDIT: I’ve got the mirroring to work thanks to POLYGAMe and Alex, but now the object being mirrored doesn’t seem to react to gravity. It will float if the player is at a higher altitude, and it will go through walls (and sometimes go through the player). Here is a video of the problem:

Depends on the axis over which you want to mirror your player. In case it is the x axis (left to right) and the centre of your game world is at Vector3.zero your code could be something like

var centrePosition : Vector3 = Vector3.zero;

function Update()
{
    mirrorPos = transform.position;
    mirrorPos.x = centrePosition.x + (centrePosition.x-transform.position.x);
    mirrorObject.transform.position = mirrorPos ;
}