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

Commit

Permalink
hack fix avatars always spawning and scenes not loading after adding …
Browse files Browse the repository at this point in the history
…cache busting
  • Loading branch information
HexaField committed Jun 21, 2024
1 parent 93e2400 commit e9c976d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/benchmarksAllRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@etherealengine/client-core/src/world/LocationModule'
import '@etherealengine/engine/src/EngineModule'
import { setComponent } from '@etherealengine/ecs'
import React, { useEffect } from 'react'
import { BenchmarkComponent } from './engine/Register'
Expand Down
2 changes: 1 addition & 1 deletion src/benchmarksRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import '@etherealengine/client-core/src/world/LocationModule'
import '@etherealengine/engine/src/EngineModule'
import AvatarBenchmarkEntry from './benchmarks/avatarBenchmark'
import AvatarIKBenchmarkEntry from './benchmarks/avatarIKBenchmark'
import HeapBenchmarkEntry from './benchmarks/heapBenchmark'
Expand Down
2 changes: 1 addition & 1 deletion src/examplesRoute.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'

import '@etherealengine/client-core/src/world/LocationModule'
import '@etherealengine/engine/src/EngineModule'
import AvatarMocapEntry from './examples/avatarMocap'
import AvatarTestEntry from './examples/avatarTest'
import ComponentExamplesRoute, { subComponentExamples } from './examples/componentExamples/componentExamples'
Expand Down
11 changes: 8 additions & 3 deletions src/sceneRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import React, { useEffect, useRef, useState } from 'react'

import { useLoadEngineWithScene, useNetwork } from '@etherealengine/client-core/src/components/World/EngineHooks'
import { useLoadScene } from '@etherealengine/client-core/src/components/World/LoadLocationScene'
import '@etherealengine/client-core/src/world/LocationModule'
import '@etherealengine/engine/src/EngineModule'
import { Engine, Entity, getComponent, setComponent } from '@etherealengine/ecs'
import { GLTFAssetState } from '@etherealengine/engine/src/gltf/GLTFState'
import { useHookstate, useImmediateEffect, useMutableState } from '@etherealengine/hyperflux'
import { CameraComponent } from '@etherealengine/spatial/src/camera/components/CameraComponent'
import { CameraOrbitComponent } from '@etherealengine/spatial/src/camera/components/CameraOrbitComponent'
import { InputComponent } from '@etherealengine/spatial/src/input/components/InputComponent'
import { RendererComponent } from '@etherealengine/spatial/src/renderer/WebGLRendererSystem'
import { staticResourcePath } from '@etherealengine/common/src/schema.type.module'
import { useFind } from '@etherealengine/spatial/src/common/functions/FeathersHooks'

type Metadata = {
name: string
Expand Down Expand Up @@ -55,16 +57,19 @@ export const useRouteScene = (projectName = 'ee-development-test-suite', sceneNa
useLoadScene({ projectName: projectName, sceneName: sceneName })
useNetwork({ online: false })
useLoadEngineWithScene()
const sceneKey = `projects/${projectName}/${sceneName}`
const assetQuery = useFind(staticResourcePath, { query: { key: sceneKey, type: 'scene' } })

const gltfState = useMutableState(GLTFAssetState)
const sceneEntity = useHookstate<undefined | Entity>(undefined)

useEffect(() => {
const sceneURL = `projects/${projectName}/${sceneName}`
if (!assetQuery.data[0]) return
const sceneURL = assetQuery.data[0].url
if (!gltfState[sceneURL].value) return
const entity = gltfState[sceneURL].value
if (entity) sceneEntity.set(entity)
}, [gltfState])
}, [assetQuery.data, gltfState])

useImmediateEffect(() => {
const entity = Engine.instance.viewerEntity
Expand Down

0 comments on commit e9c976d

Please sign in to comment.