Skip to content

Commit c2e2cbb

Browse files
authored
Merge pull request #336 from taeuscherpferd/Add-OrbitControls-to-pitfalls-in-docs
docs: Added OrbitControls to pitfalls
2 parents 29bbffd + 61f9a66 commit c2e2cbb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/advanced/pitfalls.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,17 @@ If you cannot enter the VR or AR experience while the assets in your scene are l
4141
## XRSpace
4242

4343
If you are placing `<XRSpace>` components outside of the `<XROrigin>` while changing the transformation of the `<XROrigin>` (e.g. by setting `<XROrigin position={[0,1,0]} />`), the elements rendered inside of the `<XRSpace>` will not be transformed with the origin. If the transformations of the origin should be applied to the `<XRSpace>`, make sure to place those components inside the `<XROrigin>`. Not placing `<XRSpace>` components into the `<XROrigin>` can be useful in scenarios where you want to move the `<XROrigin>` independently from the `<XRSpace>`. For instance, building a virtual elevator where your actual room is duplicated into the x-axis so that you can use the elevator to travel between multiple instances of your room.
44+
45+
## OrbitControls
46+
47+
If you have OrbitControls in your scene, make sure to place an `<IfInSessionMode>` guard around them when in XR. Having OrbitControls enabled causes the VR camera to report false values and behave in strange ways.
48+
49+
```tsx
50+
const OrbitControlsWrapper = () => {
51+
return (
52+
<IfInSessionMode deny={['immersive-ar', 'immersive-vr']} >
53+
<OrbitControls />
54+
</IfInSessionMode>
55+
)
56+
}
57+
```

0 commit comments

Comments
 (0)