Modules and saving an objects position for later use?

Hi all.

Im trying to start up an old, and I mean old, idea I had with Blender. Im slowly getting my head back into python syntax, been using C# for an age now, but I`m stuck on a possibly daft one…

I`m saving the initial positions of a few objects and was wanting to recall them by the click of a button.

I`ve imported the bge and then logic as l.

Then was hoping to just do,

initPlayerPosition = l.getCurrentScene().objects[‘Player’].position

But, when I set currPlayerPosition = initPlayerPosition it seems to call the whole l.getScene()… process.
So even though currPlayerPosition is set equal to initPlayerPosition as I want, the initPlayerPosition is being changed as I do it?!!
I just want the Vector3 position?

Hope I`ve explained myself ok and given enough info.

Thanks in advance hopefully.

ohh, Im using a Module with def initPlayerPos(): Im just getting used to how they work. Im liking them so far. Thanks Monster, Ive read alot of your posts. :slight_smile:

KX_GameObject.position is deprecated and ambiguous. Better use worldPosition or localPosition.

As you will get a reference to the real position, this position will change with the movement of the game object.
Better create a copy of the vector with worldPosition.copy()

Thanks Monster, you`re a gentleman.

worldPosition.copy() was exactly what I needed. It works like a charm now.

You`ve made my christmas card list. :slight_smile:

the ambiguity can be given just by the existence of (useless) >> * world family * <<

this give ambiguity (and give also mess in kxgameobject)

the word recurrent MUST be more short possible, at least which is really ambigue.