mml-io / mml

Metaverse Markup Language
https://mml.io
MIT License
121 stars 13 forks source link

fixes false-positive m-position-probe collision events #106

Closed TheCodeTherapy closed 1 year ago

TheCodeTherapy commented 1 year ago

This PR aims to fix the <m-position-probe> from triggering false-positive collision events that were happening with new users joining.

The problem was easy to reproduce by joining the 3d-web-experience in a scene with an MML object that contains an <m-position-probe> tag by opening a new tab without focusing it, or by having the server restarted by CI/CD being triggered while there was users still connected to the scene.

The cause was the container argument at the getRelativePositionAndRotationRelativeToObject function on position-utils.ts not having its matrixWorld property calculated before the new client renders its first frame (which is prevented as the new client joined through an unfocused tab, which prevents the execution the required steps)


What kind of changes does your PR introduce? (check at least one)

Does your PR introduce a breaking change? (check one)

If yes, please describe its impact and migration path for existing applications:

Does your PR fulfill the following requirements?