actually delete lights now that it doesnt crash

This commit is contained in:
James B. Pollack 2015-12-11 17:23:35 -08:00
parent 11aaeb1ec0
commit 1b1edf6f7a

View file

@ -122,7 +122,7 @@ var USE_ENTITY_LASERS_FOR_MOVING = true;
var USE_OVERLAY_LINES_FOR_SEARCHING = true; var USE_OVERLAY_LINES_FOR_SEARCHING = true;
var USE_PARTICLE_BEAM_FOR_SEARCHING = false; var USE_PARTICLE_BEAM_FOR_SEARCHING = false;
var USE_PARTICLE_BEAM_FOR_MOVING = false; var USE_PARTICLE_BEAM_FOR_MOVING = false;
var USE_SPOTLIGHT = false; var USE_SPOTLIGHT = true;
var USE_POINTLIGHT = false; var USE_POINTLIGHT = false;
// states for the state machine // states for the state machine
@ -436,10 +436,8 @@ function MyController(hand) {
var finalRotation = Quat.multiply(orientation, rotation); var finalRotation = Quat.multiply(orientation, rotation);
if (this.particleBeam === null) { if (this.particleBeam === null) {
print('create beam')
this.createParticleBeam(position, finalRotation, color); this.createParticleBeam(position, finalRotation, color);
} else { } else {
print('update beam')
this.updateParticleBeam(position, finalRotation, color); this.updateParticleBeam(position, finalRotation, color);
} }
} }
@ -590,11 +588,8 @@ function MyController(hand) {
this.spotlight = Entities.addEntity(lightProperties); this.spotlight = Entities.addEntity(lightProperties);
} else { } else {
Entities.editEntity(this.spotlight, { Entities.editEntity(this.spotlight, {
parentID: parentID,
position: lightTransform.p,
//without this, this light would maintain rotation with its parent //without this, this light would maintain rotation with its parent
rotation: Quat.fromPitchYawRollDegrees(-90, 0, 0), rotation: Quat.fromPitchYawRollDegrees(-90, 0, 0),
visible: true
}) })
} }
} }
@ -627,16 +622,9 @@ function MyController(hand) {
}; };
if (this.pointlight === null) { if (this.pointlight === null) {
print('create pointlight')
this.pointlight = Entities.addEntity(lightProperties); this.pointlight = Entities.addEntity(lightProperties);
} else { } else {
print('update pointlight')
Entities.editEntity(this.pointlight, {
parentID: parentID,
position: lightTransform.p,
visible: true
})
} }
} }
@ -665,19 +653,13 @@ function MyController(hand) {
this.turnLightsOff = function() { this.turnLightsOff = function() {
//use visibility for now instead of creating and deleting since deleting seems to crash //use visibility for now instead of creating and deleting since deleting seems to crash
if (this.spotlight !== null) { if (this.spotlight !== null) {
Entities.editEntity(this.spotlight, { Entities.deleteEntity(this.spotlight);
visible: false this.spotlight = null;
})
//Entities.deleteEntity(this.spotlight);
//this.spotLight=null;
} }
if (this.pointlight !== null) { if (this.pointlight !== null) {
Entities.editEntity(this.pointlight, { Entities.deleteEntity(this.pointlight);
visible: false this.pointlight = null;
})
//Entities.deleteEntity(this.pointlight);
//this.pointlight = null;
} }
} }