-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
scripts/esm/camera-controls.mjs
Outdated
|
||
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I have removed that for now. Everything else OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.