Make camera controls script play nice with XR#7128
Conversation
|
@willeastcott - good to merge or other plans with this? |
Needs testing - I'll do that today. |
|
|
||
| // Set the camera's position to the ground | ||
| const pos = this.entity.getPosition(); | ||
| this.entity.setPosition(pos.x, 0, pos.z); |
There was a problem hiding this comment.
XR will override this position on every update, as now there is no parent node, offsetting the camera from origin is only done by moving in XR. So this line won't do anything.
For offsetting position in XR, a parent node is required.
There was a problem hiding this comment.
OK, I have removed that for now. Everything else OK?
There was a problem hiding this comment.
This also implies that initial setup of a scene, should have camera at the origin, and content somewhere in front of it, to make sure when entering in XR we are not inside of a content.
There was a problem hiding this comment.
How should we handle that then? I don't want to reintroduce the magical hidden parent node in the camera-controls.mjs script again...
There was a problem hiding this comment.
Do a proper parent node for the camera entity. And only use it for XR (not camera orbiting). And reset it when exiting XR.
There was a problem hiding this comment.
So I should create a new script called xr-navigation.mjs I guess...
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.