Keep objects world position after childing to a parent object

Hey guys,

I have an object that moves around my scene. When the player taps the object I child it to the camera for some relational tweens based on the camera position. That is all working great.

My issue now is when object gets added as a child I would like to keep its starting position the same as it was prior to getting childed.

I found there is a .attach method but it gives me the same results as .add - so I’m not really sure how to approach this.

I am attempting to cache the starting position (world pos) setting the object as a child of the camera and then passing in the starting position again but that also doesn’t do anything.

Relevant code:

var worldPos = this.model.scene.getWorldPosition();
          this.stage.camera.add(this.model.scene);
          this.model.scene.position.set(worldPos);

Thoughts? Thanks guys!

So this ended up not really being an issue. I was able to just use .attach and got it working.

The problem ended up being my positional tween, apparently defining a tween, even if it doesn’t start until a delay is over will still override the objects position! I solved this by moving when the position tween is created and all is good now!