marcel ๐ต โ
๐งต#XRRig match camera
Needle Open in Discord
marcel ๐ต โ
Hi, what's this._camera ? - any reason for not using this.context.mainCamera ?
Gilderko โ
its the this.context.mainCamera just set in start() and not changed
marcel ๐ต โ
Got it. This works for me:
https://xr-rig-forward-z23hmxbstnid-stnid.needle.run/
export class AlignRig extends Behaviour {
onBeforeXR(_mode: XRSessionMode, _args: XRSessionInit): void {
const rigs = this.context.scene.getComponentsInChildren(XRRig);
for (const rig of rigs) {
rig.gameObject.worldPosition = this.context.mainCamera.worldPosition;
rig.gameObject.worldQuaternion = this.context.mainCamera.worldQuaternion;
rig.gameObject.rotateY(Math.PI); // three camera is -z forward and rig is z forward
}
}
}
marcel ๐ต โ
Could you try it again with the same code?
Gilderko โ
ou yeah looks good thx I was trying something like this but was rotating around global Y <a:Facepalm:604043588057169940>
Gilderko โ
<:Prayge:806979414122299392>
marcel ๐ต โ
Ok great!