Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
add empty webxr test route
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Apr 4, 2024
1 parent 54e1861 commit ae7d653
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/WebXR.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { MediaIconsBox } from '@etherealengine/client-core/src/components/MediaIconsBox'
import { Shelves } from '@etherealengine/client-core/src/components/Shelves'
import { XRLoading } from '@etherealengine/client-core/src/components/XRLoading'
import { Engine, setComponent } from '@etherealengine/ecs'
import { loadEmptyScene } from '@etherealengine/engine/tests/util/loadEmptyScene'
import { getMutableState } from '@etherealengine/hyperflux'
import { CameraOrbitComponent } from '@etherealengine/spatial/src/camera/components/CameraOrbitComponent'
import { RendererState } from '@etherealengine/spatial/src/renderer/RendererState'
import { BackgroundComponent } from '@etherealengine/spatial/src/renderer/components/SceneComponents'
import { EntityTreeComponent } from '@etherealengine/spatial/src/transform/components/EntityTree'
import React, { useEffect } from 'react'
import { Color } from 'three'

export default function WebXR() {
useEffect(() => {
getMutableState(RendererState).gridVisibility.set(true)
const sceneEntity = loadEmptyScene()!
setComponent(sceneEntity, EntityTreeComponent, { parentEntity: Engine.instance.originEntity })
setComponent(sceneEntity, BackgroundComponent, new Color('black'))
setComponent(Engine.instance.viewerEntity, CameraOrbitComponent)
}, [])

return (
<>
<div style={{ pointerEvents: 'all' }}>
<Shelves />
<XRLoading />
<MediaIconsBox />
</div>
</>
)
}

0 comments on commit ae7d653

Please sign in to comment.