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

Commit

Permalink
add back step 1
Browse files Browse the repository at this point in the history
  • Loading branch information
HexaField committed Feb 17, 2024
1 parent 51eb5b8 commit 98fd41d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions src/Hello1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ECS } from '@etherealengine/ecs'
import { PhysicsSystem } from '@etherealengine/spatial/src/physics/PhysicsModule'
import { NameComponent } from '@etherealengine/spatial/src/common/NameComponent'
import { VisibleComponent } from '@etherealengine/spatial/src/renderer/components/VisibleComponent'
import { TransformComponent } from '@etherealengine/spatial/src/transform/components/TransformComponent'
import { PrimitiveGeometryComponent } from '@etherealengine/engine/src/scene/components/PrimitiveGeometryComponent'
import { Vector3 } from 'three'
import { GeometryTypeEnum } from '@etherealengine/engine/src/scene/constants/GeometryTypeEnum'


let initialized = false // Track whether our code was already run or not

// Our new function
const hello = () => {
if (initialized) return
initialized = true

// Create the Sphere object inside our function.
const entity = ECS.createEntity()
ECS.setComponent(entity, NameComponent, 'hello-world')
ECS.setComponent(entity, VisibleComponent)
ECS.setComponent(entity, TransformComponent, { position: new Vector3(0, 1, 0) })
ECS.setComponent(entity, PrimitiveGeometryComponent, { geometryType: GeometryTypeEnum.SphereGeometry })
}

// Define our System
export const HelloWorldSystem = ECS.defineSystem({
uuid: 'helloworld.system',
execute: hello,
insert: { after: PhysicsSystem }
})
File renamed without changes.
2 changes: 1 addition & 1 deletion xrengine.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const config: ProjectConfigInterface = {
routes: {},
services: undefined,
databaseSeed: undefined,
worldInjection: () => import('./src/Hello')
worldInjection: () => import('./src/Hello1')
}

export default config

0 comments on commit 98fd41d

Please sign in to comment.