1
1
import React , { useEffect } from 'react'
2
2
3
- import { Engine , EntityUUID } from '@etherealengine/ecs'
4
3
import { isClient } from '@etherealengine/common/src/utils/getEnvironment'
5
- import { SimulationSystemGroup , defineSystem , getComponent , setComponent } from '@etherealengine/ecs'
4
+ import {
5
+ Engine ,
6
+ EntityUUID ,
7
+ SimulationSystemGroup ,
8
+ UUIDComponent ,
9
+ defineSystem ,
10
+ getComponent ,
11
+ setComponent
12
+ } from '@etherealengine/ecs'
6
13
import { ECSState } from '@etherealengine/ecs/src/ECSState'
7
14
import { PrimitiveGeometryComponent } from '@etherealengine/engine/src/scene/components/PrimitiveGeometryComponent'
8
15
import { GeometryTypeEnum } from '@etherealengine/engine/src/scene/constants/GeometryTypeEnum'
@@ -17,7 +24,7 @@ import {
17
24
} from '@etherealengine/hyperflux'
18
25
import { NetworkState , NetworkTopics , WorldNetworkAction } from '@etherealengine/network'
19
26
import { NameComponent } from '@etherealengine/spatial/src/common/NameComponent'
20
- import { UUIDComponent } from '@etherealengine/ecs '
27
+ import { Physics } from '@etherealengine/spatial/src/physics/classes/Physics '
21
28
import { ColliderComponent } from '@etherealengine/spatial/src/physics/components/ColliderComponent'
22
29
import { RigidBodyComponent } from '@etherealengine/spatial/src/physics/components/RigidBodyComponent'
23
30
import { VisibleComponent } from '@etherealengine/spatial/src/renderer/components/VisibleComponent'
@@ -98,7 +105,7 @@ const BasicObject = ({ entityUUID }: { entityUUID: EntityUUID }) => {
98
105
const angle = Math . random ( ) * Math . PI * 2
99
106
const direction = new Vector3 ( Math . sin ( angle ) , 0 , Math . cos ( angle ) )
100
107
const velocity = 0.025 + Math . random ( ) * 0.01
101
- getComponent ( entity , RigidBodyComponent ) . body . applyImpulse ( direction . multiplyScalar ( velocity ) , true )
108
+ Physics . applyImpulse ( entity , direction . multiplyScalar ( velocity ) )
102
109
} , [ entity ] )
103
110
104
111
return null
@@ -123,7 +130,7 @@ const execute = () => {
123
130
counter = 0
124
131
125
132
const entityUUID = `basic-${ elapsedSeconds } ` as EntityUUID
126
- const action = BasicActions . spawnAction ( {
133
+ const action = BasicActions . spawnAction ( {
127
134
parentUUID : getComponent ( Engine . instance . originEntity , UUIDComponent ) ,
128
135
entityUUID,
129
136
position : new Vector3 ( Math . random ( ) , 1 , Math . random ( ) )
0 commit comments