This repository has been archived by the owner on Aug 18, 2024. It is now read-only.
generated from EtherealEngine/ee-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters