Skip to content

Commit 17b9342

Browse files
authored
Merge pull request #469 from Jlu18/three-dependency
Fixed the indicator freeze the MYR scene
2 parents 27d31ee + d48bffd commit 17b9342

4 files changed

Lines changed: 20 additions & 19 deletions

File tree

src/components/structural/View.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,18 @@ class View extends Component {
154154
//ambient light doesn't have an indicator
155155
switch(ent.light.type){
156156
case "point":
157-
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} pointlightindicator={`color: ${ent.color};`} layer="type:group; layer:1"></a-entity>;
157+
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} pointlightindicator={`color: ${ent.color};`} setlayer="type:group; layer:1"></a-entity>;
158158
case "spot":
159159
let target = true;
160160
if(!ent.light.target) {
161161
position = "";
162162
target = false;
163163
}
164-
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} spotlightindicator={`color: ${ent.color}; target:${target}`} indicatorrotation={position} layer="type:group; layer:1"></a-entity>;
164+
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} spotlightindicator={`color: ${ent.color}; target:${target}`} indicatorrotation={position} setlayer="type:group; layer:1"></a-entity>;
165165
case "directional":
166-
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} directionallightindicator={`color: ${ent.color};`} indicatorrotation={position} layer="type:group; layer:1"></a-entity>;
166+
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} directionallightindicator={`color: ${ent.color};`} indicatorrotation={position} setlayer="type:group; layer:1"></a-entity>;
167167
case "hemisphere":
168-
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} hemispherelightindicator={`color: ${ent.color}; secondColor: ${ent.light.secondColor}`} layer="type:group; layer:1"></a-entity>;
168+
return <a-entity id={ent.id+"Ind"} key={ent.id+"Ind"} hemispherelightindicator={`color: ${ent.color}; secondColor: ${ent.light.secondColor}`} setlayer="type:group; layer:1"></a-entity>;
169169
default:
170170
}
171171
}
@@ -231,6 +231,7 @@ class View extends Component {
231231
position={this.props.sceneConfig.settings.cameraPosition}
232232
look-controls="pointerLockEnabled: true">
233233
<a-cursor
234+
raycaster="objects:.raycastable"
234235
position="0 0 -1"
235236
geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03;"
236237
material="color: #CCC; shader: flat;" />
@@ -245,6 +246,7 @@ class View extends Component {
245246
<a-camera
246247
position={this.props.sceneConfig.settings.cameraPosition}>
247248
<a-cursor
249+
raycaster="objects:.raycastable"
248250
position="0 0 -1"
249251
geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03;"
250252
material="color: #CCC; shader: flat;" />
@@ -260,6 +262,7 @@ class View extends Component {
260262
look-controls="pointerLockEnabled: true"
261263
wasd-plus-controls="enabled: true">
262264
<a-cursor
265+
raycaster="objects:.raycastable"
263266
position="0 0 -1"
264267
geometry="primitive: ring; radiusInner: 0.02; radiusOuter: 0.03;"
265268
material="color: #CCC; shader: flat;" />
@@ -278,32 +281,32 @@ class View extends Component {
278281
if (this.props.sceneConfig.settings.showCoordHelper) {
279282
return (
280283
<Fragment>
281-
<a-grid height="53.33" width="53.33" position="-0.5 -0.26 -0.5" scale="1.5 1.5 1.5" layer="type:mesh;layer:1;"/>
282-
<a-tube path="-35 -0.2 0, 35 -0.2 0" radius="0.05" material="color: red" layer="type:mesh;layer:1;"></a-tube>
283-
<a-tube path="0 -0.2 -35, 0 -0.2 35" radius="0.05" material="color: blue" layer="type:mesh;layer:1;"></a-tube>
284+
<a-grid height="53.33" width="53.33" position="-0.5 -0.26 -0.5" scale="1.5 1.5 1.5" setlayer="type:mesh;layer:1;"/>
285+
<a-tube path="-35 -0.2 0, 35 -0.2 0" radius="0.05" material="color: red" setlayer="type:mesh;layer:1;"></a-tube>
286+
<a-tube path="0 -0.2 -35, 0 -0.2 35" radius="0.05" material="color: blue" setlayer="type:mesh;layer:1;"></a-tube>
284287
<a-text
285288
color="#555"
286289
rotation="0 0 0"
287290
position="-0.0005 .1 0"
288291
side="double"
289292
align="center"
290293
value="- X X +"
291-
layer="type:text;layer:1;"></a-text>
294+
setlayer="type:text;layer:1;"></a-text>
292295
<a-text
293296
color="#555"
294297
rotation="0 90 0"
295298
position="0 .1 -0.01"
296299
side="double"
297300
align="center"
298301
value="+ Z Z -"
299-
layer="type:text;layer:1;"></a-text>
302+
setlayer="type:text;layer:1;"></a-text>
300303
<a-text
301304
color="#555"
302305
rotation="0 90 90"
303306
position="0 .1 0"
304307
side="double"
305308
value=" Y + "
306-
layer="type:text;layer:1;"></a-text>
309+
setlayer="type:text;layer:1;"></a-text>
307310
</Fragment>
308311
);
309312
} else {
@@ -341,7 +344,6 @@ class View extends Component {
341344
<a-img id="reference" src={`${process.env.PUBLIC_URL}/img/coordHelper.jpg`} />
342345
{this.props.assets ? this.props.assets.map((x) => this.assetsHelper(x)) : null}
343346
</a-assets>
344-
<this.createCam />
345347
<a-sky color={this.props.sceneConfig.settings.skyColor} />
346348
<this.coordinateHelper />
347349
<this.makeFloor />
@@ -354,17 +356,16 @@ class View extends Component {
354356
}
355357
{this.props.sceneConfig.settings.lightIndicator||this.props.sceneConfig.settings.showCoordHelper ?
356358
<a-entity id="AltLayerLight">
357-
<a-entity id="AmbientLight" light="type: ambient; color: #BBB" layer="type:light;layer:1;"></a-entity>
358-
<a-entity id="DirectionalLight" light={"type: directional; color: #FFF; intensity: 0.6; " + this.lightShadowHelper({state: "",type: "directional"})} position="-3 3 1" layer="type:light;layer:1;"></a-entity>
359+
<a-entity id="AmbientLight" light="type: ambient; color: #BBB" setlayer="type:light;layer:1;"></a-entity>
360+
<a-entity id="DirectionalLight" light={"type: directional; color: #FFF; intensity: 0.6; " + this.lightShadowHelper({state: "",type: "directional"})} position="-3 3 1" setlayer="type:light;layer:1;"></a-entity>
359361
</a-entity>
360362
: null}
361363
{ // create the entities
362364
Object.keys(this.props.objects).map(it => {
363365
return this.helper(this.props.objects[it]);
364366
})
365367
}
366-
367-
368+
<this.createCam />
368369
{this.props.sceneConfig.settings.camConfig === 1 ?
369370
<a-entity position="0 0 0">
370371
<a-cylinder checkpoint radius="1" height="0.3" position="-25 1 -25" color="#39BB82"></a-cylinder>

src/utils/AFramePhysics.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import AFRAME from "aframe";
2-
import * as THREE from "three";
2+
const THREE = AFRAME.THREE;
33

44
AFRAME.registerComponent("force-pushable", {
55
schema: {
@@ -27,7 +27,7 @@ AFRAME.registerComponent("force-pushable", {
2727
//This set aframe entity to different layer (range from 0-31)
2828
//all the regular MYR entities will goes to layer 0
2929
//And other, such as grid, light indicator will goes to layer 1 so it won't take effect of user created light
30-
AFRAME.registerComponent("layer",{
30+
AFRAME.registerComponent("setlayer",{
3131
schema:{
3232
type:{
3333
type:"string",

src/utils/AframeRegIndicator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import AFRAME from "aframe";
2-
import * as THREE from "three";
2+
const THREE = AFRAME.THREE;
33

44

55
AFRAME.registerComponent("spotlightindicator",{

src/utils/WASDPlusControls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import AFRAME from "aframe";
3-
import * as THREE from "three";
3+
const THREE = AFRAME.THREE;
44
const bind = AFRAME.utils.bind;
55
const shouldCaptureKeyEvent = AFRAME.utils.shouldCaptureKeyEvent;
66

0 commit comments

Comments
 (0)