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

Commit

Permalink
Merge branch 'dev' into scene-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelEstes committed Jul 30, 2024
2 parents 0c73be3 + e395b63 commit 726fdb5
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/engine/benchmarks/BenchmarkNodeEditors.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import NodeEditor from '@etherealengine/editor/src/components/properties/NodeEditor'
import { EditorComponentType } from '@etherealengine/editor/src/components/properties/Util'
import NodeEditor from '@etherealengine/ui/src/components/editor/properties/nodeEditor'
import React from 'react'

export const ProfilingComponentNodeEditor: EditorComponentType = (props) => {
Expand Down
4 changes: 2 additions & 2 deletions src/examples/InstanceConnection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ export default function InstanceConnection() {
console.log('onNetworkDisconnect')
const instanceID = Object.keys(getState(LocationInstanceState).instances)[0]
const network = getState(NetworkState).networks[instanceID] as SocketWebRTCClientNetwork | Network
if ('primus' in network.transport) network.transport.primus.end()
if ('primus' in network) network.primus.end()
}

const onNetworkLostConnection = () => {
console.log('debug onNetworkLostConnection')
const instanceID = Object.keys(getState(LocationInstanceState).instances)[0]
const network = getState(NetworkState).networks[instanceID] as SocketWebRTCClientNetwork | Network
if ('heartbeat' in network.transport) clearInterval(network.transport.heartbeat)
if ('heartbeat' in network) clearInterval(network.heartbeat)
/** in 10 seconds, the server will end the connection to the client and remove it's peer */
}

Expand Down
2 changes: 1 addition & 1 deletion src/examples/PostProcessing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import { LocationIcons } from '@etherealengine/client-core/src/components/Locati
import { useQuery } from '@etherealengine/ecs'
import { getComponent, updateComponent } from '@etherealengine/ecs/src/ComponentFunctions'
import { Entity } from '@etherealengine/ecs/src/Entity'
import { PostProcessingSettingsEditor } from '@etherealengine/editor/src/components/properties/PostProcessingSettingsEditor'
import { EditorControlFunctions } from '@etherealengine/editor/src/functions/EditorControlFunctions'
import { SelectionState } from '@etherealengine/editor/src/services/SelectionServices'
import { UUIDComponent } from '@etherealengine/ecs'
import { useSearchParams } from 'react-router-dom'
import { Template } from './utils/template'
import { PostProcessingComponent } from '@etherealengine/spatial/src/renderer/components/PostProcessingComponent'
import PostProcessingSettingsEditor from '@etherealengine/ui/src/components/editor/properties/postProcessing'

export default function PostProcessing() {
const entity = useHookstate<Entity | null>(null)
Expand Down
2 changes: 1 addition & 1 deletion src/examples/VisualScript.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

import { setComponent } from '@etherealengine/ecs/src/ComponentFunctions'
import { createEntity } from '@etherealengine/ecs/src/EntityFunctions'
import { ActiveVisualScript } from '@etherealengine/editor/src/components/visualScript/VisualFlow'
import { ActiveVisualScript } from '@etherealengine/ui/src/components/editor/panels/VisualScript/container'
import { VisualScriptComponent } from '@etherealengine/engine'
import { GraphJSON } from '@etherealengine/visual-script'
import AutoSizer from 'react-virtualized-auto-sizer'
Expand Down
43 changes: 23 additions & 20 deletions src/examples/multipleScenes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,58 +20,59 @@ import { GLTFComponent } from '@etherealengine/engine/src/gltf/GLTFComponent'
import { GLTFAssetState, GLTFSourceState } from '@etherealengine/engine/src/gltf/GLTFState'
import { PrimitiveGeometryComponent } from '@etherealengine/engine/src/scene/components/PrimitiveGeometryComponent'
import { GeometryTypeEnum } from '@etherealengine/engine/src/scene/constants/GeometryTypeEnum'
import { getMutableState, getState, useHookstate, useImmediateEffect } from '@etherealengine/hyperflux'
import { getMutableState, useHookstate, useImmediateEffect } from '@etherealengine/hyperflux'
import { DirectionalLightComponent, PhysicsPreTransformSystem, TransformComponent } from '@etherealengine/spatial'
import { CameraComponent } from '@etherealengine/spatial/src/camera/components/CameraComponent'
import { CameraOrbitComponent } from '@etherealengine/spatial/src/camera/components/CameraOrbitComponent'
import { NameComponent } from '@etherealengine/spatial/src/common/NameComponent'
import { InputComponent } from '@etherealengine/spatial/src/input/components/InputComponent'
import { InputPointerComponent } from '@etherealengine/spatial/src/input/components/InputPointerComponent'
import { InputState } from '@etherealengine/spatial/src/input/state/InputState'
import { Physics, RaycastArgs } from '@etherealengine/spatial/src/physics/classes/Physics'
import { ColliderComponent } from '@etherealengine/spatial/src/physics/components/ColliderComponent'
import { RigidBodyComponent } from '@etherealengine/spatial/src/physics/components/RigidBodyComponent'
import { CollisionGroups } from '@etherealengine/spatial/src/physics/enums/CollisionGroups'
import { getInteractionGroups } from '@etherealengine/spatial/src/physics/functions/getInteractionGroups'
import { SceneQueryType } from '@etherealengine/spatial/src/physics/types/PhysicsTypes'
import { RendererState } from '@etherealengine/spatial/src/renderer/RendererState'
import { RendererComponent } from '@etherealengine/spatial/src/renderer/WebGLRendererSystem'
import { Object3DComponent } from '@etherealengine/spatial/src/renderer/components/Object3DComponent'
import { SceneComponent } from '@etherealengine/spatial/src/renderer/components/SceneComponents'
import { VisibleComponent } from '@etherealengine/spatial/src/renderer/components/VisibleComponent'
import {
MaterialInstanceComponent,
MaterialStateComponent
} from '@etherealengine/spatial/src/renderer/materials/MaterialComponent'
import { EntityTreeComponent, isAncestor } from '@etherealengine/spatial/src/transform/components/EntityTree'
import { EntityTreeComponent } from '@etherealengine/spatial/src/transform/components/EntityTree'
import { computeTransformMatrix } from '@etherealengine/spatial/src/transform/systems/TransformSystem'
import { GLTF } from '@gltf-transform/core'
import React, { useEffect } from 'react'
import { Cache, Color, Euler, Group, MathUtils, Matrix4, MeshLambertMaterial, Quaternion, Vector3 } from 'three'
import { Cache, Color, Euler, MathUtils, Matrix4, MeshLambertMaterial, Quaternion, Vector3 } from 'three'
import { Transform } from './utils/transform'

const TestSuiteBallTagComponent = defineComponent({ name: 'TestSuiteBallTagComponent' })
let physicsEntityCount = 0
export const createPhysicsEntity = (sceneEntity: Entity) => {
const entity = createEntity()

const i = physicsEntityCount++

const position = new Vector3(Math.random() * 10 - 5, Math.random() * 2 + 2, Math.random() * 10 - 5)
setComponent(entity, UUIDComponent, ('Ball-' + physicsEntityCount++) as EntityUUID)
setComponent(entity, UUIDComponent, ('Ball-' + i) as EntityUUID)
setComponent(entity, EntityTreeComponent, { parentEntity: sceneEntity })
setComponent(entity, TransformComponent, { position, scale: new Vector3(0.5, 0.5, 0.5) })
setComponent(entity, PrimitiveGeometryComponent, {
geometryType: GeometryTypeEnum.SphereGeometry
})
setComponent(entity, TransformComponent, { position, scale: new Vector3(2, 2, 2) })
setComponent(entity, VisibleComponent, true)
setComponent(entity, RigidBodyComponent, { type: 'dynamic' })
setComponent(entity, ColliderComponent, {
setComponent(entity, TestSuiteBallTagComponent)

const colliderEntity = createEntity()
setComponent(colliderEntity, VisibleComponent, true)
setComponent(colliderEntity, UUIDComponent, ('Ball-' + i + '-collider') as EntityUUID)
setComponent(colliderEntity, EntityTreeComponent, { parentEntity: entity })
setComponent(colliderEntity, TransformComponent, { scale: new Vector3(0.25, 0.25, 0.25) })
setComponent(colliderEntity, ColliderComponent, {
shape: 'sphere',
mass: MathUtils.randFloat(0.5, 1.5),
friction: MathUtils.randFloat(0.1, 1.0),
restitution: MathUtils.randFloat(0.1, 1.0)
})
setComponent(entity, TestSuiteBallTagComponent)
setComponent(entity, InputComponent)
setComponent(colliderEntity, PrimitiveGeometryComponent, {
geometryType: GeometryTypeEnum.SphereGeometry
})
setComponent(colliderEntity, InputComponent)

return entity
}
Expand Down Expand Up @@ -192,8 +193,10 @@ const execute = () => {
transform.position.set(Math.random() * 10 - 5, Math.random() * 2 + 2, Math.random() * 10 - 5)
}

const isPointerOver = getComponent(entity, InputComponent).inputSources.length > 0
const materialInstance = getOptionalComponent(entity, MaterialInstanceComponent)
const colliderEntity = getComponent(entity, EntityTreeComponent).children[0]

const isPointerOver = getComponent(colliderEntity, InputComponent).inputSources.length > 0
const materialInstance = getOptionalComponent(colliderEntity, MaterialInstanceComponent)
if (!materialInstance) continue
const materialEntity = UUIDComponent.getEntityByUUID(materialInstance.uuid[0])
const material = getComponent(materialEntity, MaterialStateComponent).material as MeshLambertMaterial
Expand Down
6 changes: 3 additions & 3 deletions src/sceneRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ const Routes = (props: { routeCategories: RouteCategories; header: string }) =>
)[0]

useEffect(() => {
if (selectedRoute.spawnAvatar) SearchParamState.set('spectate', '')
else SearchParamState.set('spectate', none)
}, [selectedRoute.spawnAvatar])
if (selectedRoute?.spawnAvatar) SearchParamState.set('spectate', none)
else SearchParamState.set('spectate', '')
}, [selectedRoute])

const Entry = selectedRoute && selectedRoute.entry

Expand Down

0 comments on commit 726fdb5

Please sign in to comment.