beams with spotlights

This commit is contained in:
James B. Pollack 2015-12-10 17:39:29 -08:00
parent 16ab7e74de
commit 2acc0df1f0

View file

@ -559,7 +559,7 @@ function MyController(hand) {
//this light casts the beam //this light casts the beam
var lightProperties = { var lightProperties = {
type: "Light", type: "Light",
isSpotlight: true, isSpotlight: false,
dimensions: { dimensions: {
x: 2, x: 2,
y: 2, y: 2,
@ -576,17 +576,18 @@ function MyController(hand) {
cutoff: 20, cutoff: 20,
lifetime: LIFETIME, lifetime: LIFETIME,
position: lightTransform.p, position: lightTransform.p,
rotation: lightTransform.q, // rotation: lightTransform.q,
}; };
if (this.spotlight === null) { if (this.spotlight === null) {
this.spotlight = Entities.addEntity(lightProperties); this.spotlight = Entities.addEntity(lightProperties);
} else { } else {
// var rotationBetween = Quat.rotationBetween(Vec3.UP, ) Entities.editEntity(this.spotlight, {
// Entities.editEntity(this.spotlight, { parentID:parentID,
// rotation: lightTransform.q position:lightTransform.p,
// }) visible:true
})
} }
} }
@ -616,9 +617,13 @@ function MyController(hand) {
this.spotlightOff = function() { this.spotlightOff = function() {
if (this.spotlight !== null) { if (this.spotlight !== null) {
Overlays.deleteOverlay(this.spotlight); print('SHOULD DELETE SPOTLIGHT' + this.spotlight)
Entities.editEntity(this.spotlight,{
visible:false
})
//Entities.deleteEntity(this.spotlight);
} }
this.spotlight = null; //this.spotlight = null;
} }
this.triggerPress = function(value) { this.triggerPress = function(value) {
@ -1416,6 +1421,7 @@ function MyController(hand) {
this.release(); this.release();
this.endHandGrasp(); this.endHandGrasp();
Entities.deleteEntity(this.particleBeam); Entities.deleteEntity(this.particleBeam);
Entities.deleteEntity(this.spotLight);
}; };
this.activateEntity = function(entityID, grabbedProperties) { this.activateEntity = function(entityID, grabbedProperties) {