diff --git a/examples/toys/masterResetEntity.js b/examples/toys/masterResetEntity.js index 28fa075e8b..50dc064e46 100644 --- a/examples/toys/masterResetEntity.js +++ b/examples/toys/masterResetEntity.js @@ -24,74 +24,74 @@ deleteAllToys(); createAllToys(); function createAllToys() { - createBlocks({ - x: 548.3, - y: 495.55, - z: 504.4 - }); + // createBlocks({ + // x: 548.3, + // y: 495.55, + // z: 504.4 + // }); - createSprayCan({ - x: 549.7, - y: 495.6, - z: 503.91 - }); + // createSprayCan({ + // x: 549.7, + // y: 495.6, + // z: 503.91 + // }); - createBasketBall({ - x: 547.73, - y: 495.5, - z: 505.47 - }); + // createBasketBall({ + // x: 547.73, + // y: 495.5, + // z: 505.47 + // }); - createDoll({ - x: 546.67, - y: 495.41, - z: 505.09 - }); - - createWand({ - x: 546.71, - y: 495.55, - z: 506.15 - }); - - createDice(); - - createFlashlight({ - x: 545.72, - y: 495.41, - z: 505.78 - }); - - createCat({ - x: 551.09, - y: 494.98, - z: 503.49 - }); - - // //Handles toggling of all sconce lights - createLightSwitches(); - - - - createCombinedArmChair({ - x: 549.29, - y: 495.05, - z: 508.22 - }) - - createPottedPlant({ - x: 554.26, - y: 495.23, - z: 504.53 - }); - - - // createWhiteboard({ - // x: 540, + // createDoll({ + // x: 546.67, // y: 495.41, + // z: 505.09 + // }); + + // createWand({ + // x: 546.71, + // y: 495.55, // z: 506.15 // }); + // createDice(); + + // createFlashlight({ + // x: 545.72, + // y: 495.41, + // z: 505.78 + // }); + + // createCat({ + // x: 551.09, + // y: 494.98, + // z: 503.49 + // }); + + // // //Handles toggling of all sconce lights + // createLightSwitches(); + + + + // createCombinedArmChair({ + // x: 549.29, + // y: 495.05, + // z: 508.22 + // }) + + // createPottedPlant({ + // x: 554.26, + // y: 495.23, + // z: 504.53 + // }); + + + createWhiteboard({ + x: 500, + y: 500, + z: 500 + }); + createGates(); diff --git a/examples/toys/whiteboard.js b/examples/toys/whiteboard.js index 94b99124c0..59d230f52c 100644 --- a/examples/toys/whiteboard.js +++ b/examples/toys/whiteboard.js @@ -37,7 +37,19 @@ }, startNearGrabNonColliding: function() { + print("START") this.whichHand = this.hand; + this.laserPointer = Entities.addEntity({ + type: "Box", + dimensions: {x: .02, y: .02, z: 0.001}, + color: {red: 200, green: 10, blue: 10}, + rotation: this.rotation + }); + + setEntityCustomData(this.resetKey, this.laserPointer, { + resetMe: true + }); + }, continueNearGrabbingNonColliding: function() { @@ -47,10 +59,16 @@ direction: Quat.getUp(this.getHandRotation()) }; var intersection = Entities.findRayIntersection(pickRay, true); - print("YA") if(intersection.intersects) { - print("INTERSECTION") + Entities.editEntity(this.laserPointer, { + position: intersection.intersection + }); } + + }, + + releaseGrab: function() { + Entities.deleteEntity(this.laserPointer); }, @@ -58,10 +76,13 @@ // it gives us a chance to set our local JavaScript object up. In this case it means: preload: function(entityID) { this.entityID = entityID; - - this.position = Entities.getEntityProperties(this.entityID, "position").position; + var props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]); + this.position = props.position; + this.rotation = props.rotation; + this.resetKey = "resetMe"; }, + }; // entity scripts always need to return a newly constructed object of our type