Q:

this.el.object3D.position.set(0,0,0) doesn't work if without breakpoint in debugger

I append a element(door) to the element of Vive(blue box) controller.
After appending I want to set the position of door as '0 0 0' with code "this.el.object3D.position.set(0,0,0)", to attach the door to the blue box.
But it doesn't work, if no breakpoint in debbuger of browser uesed.
When I set breakpoint and go through it, the result is correct.
Code with demo in Glitch: https://glitch.com/edit/#!/join/aedfdc5a-698b-4e6c-96c3-4dddfce0a6eb
Maybe someone knows the reason?
Thanks for any help.

A:

It seems the child element is not fully done appending itself when you try to change the position.
You can easily check it by making a timer, which goes after append() and changes the position.

You can use a MutationObserver, which will fire an event, when a child is attached.
Then you can make the changes:
var viveController, door
// Observer config -> what am i going to react upon
var observerOptions = {    
  childList: true,
}
// create the observer - it takes a callback as an argument
// no need to filter what event was caught, just move the damn door
var observer = new MutationObserver((e)=>{
     door.setAttribute("position", "0, 0, 0")
});

observer.observe(viveController, observerOptions);
viveController.appendChild(door)

check it out working here.

