diff --git a/examples/edit.js b/examples/edit.js index 585b45f3f9..64050d92aa 100644 --- a/examples/edit.js +++ b/examples/edit.js @@ -1197,7 +1197,11 @@ PropertiesTool = function(opts) { webView.eventBridge.webEventReceived.connect(function(data) { data = JSON.parse(data); - if (data.type == "update") { + if (data.type == "print") { + if (data.message) { + print(data.message); + } + } else if (data.type == "update") { selectionManager.saveProperties(); if (selectionManager.selections.length > 1) { properties = { diff --git a/examples/grab.js b/examples/grab.js index df2042350e..efacc26612 100644 --- a/examples/grab.js +++ b/examples/grab.js @@ -27,6 +27,7 @@ var ANGULAR_DAMPING_RATE = 0.40; var SCREEN_TO_METERS = 0.001; var currentPosition, currentVelocity, cameraEntityDistance, currentRotation; var velocityTowardTarget, desiredVelocity, addedVelocity, newVelocity, dPosition, camYaw, distanceToTarget, targetPosition; +var originalGravity; var shouldRotate = false; var dQ, theta, axisAngle, dT; var angularVelocity = { @@ -65,6 +66,7 @@ function mousePressEvent(event) { grabbedEntity = intersection.entityID; var props = Entities.getEntityProperties(grabbedEntity) isGrabbing = true; + originalGravity = props.gravity; targetPosition = props.position; currentPosition = props.position; currentVelocity = props.velocity; @@ -96,6 +98,11 @@ function updateDropLine(position) { function mouseReleaseEvent() { if (isGrabbing) { isGrabbing = false; + + Entities.editEntity(grabbedEntity, { + gravity: originalGravity + }); + Overlays.editOverlay(dropLine, { visible: false }); @@ -194,7 +201,7 @@ function update(deltaTime) { newVelocity = Vec3.subtract(newVelocity, Vec3.multiply(newVelocity, DAMPING_RATE)); // Update entity } else { - newVelocity = entityProps.velocity; + newVelocity = {x: 0, y: 0, z: 0}; } if (shouldRotate) { angularVelocity = Vec3.subtract(angularVelocity, Vec3.multiply(angularVelocity, ANGULAR_DAMPING_RATE)); @@ -204,7 +211,8 @@ function update(deltaTime) { Entities.editEntity(grabbedEntity, { velocity: newVelocity, - angularVelocity: angularVelocity + angularVelocity: angularVelocity, + gravity: {x: 0, y: 0, z: 0} }) updateDropLine(targetPosition); } @@ -215,4 +223,4 @@ Controller.mousePressEvent.connect(mousePressEvent); Controller.mouseReleaseEvent.connect(mouseReleaseEvent); Controller.keyPressEvent.connect(keyPressEvent); Controller.keyReleaseEvent.connect(keyReleaseEvent); -Script.update.connect(update); \ No newline at end of file +Script.update.connect(update); diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html index 26bcc63f15..561f39edd2 100644 --- a/examples/html/entityProperties.html +++ b/examples/html/entityProperties.html @@ -18,6 +18,12 @@ els[i].setAttribute('disabled', 'disabled'); } } + + function showElements(els, show) { + for (var i = 0; i < els.length; i++) { + els[i].style.display = (show) ? 'block' : 'none'; + } + } function createEmitCheckedPropertyUpdateFunction(propertyName) { return function() { @@ -504,6 +510,8 @@ elZoneAtmosphereScatteringWavelengthsZ.value = properties.atmosphere.scatteringWavelengths.z; elZoneAtmosphereHasStars.checked = properties.atmosphere.hasStars; + showElements(document.getElementsByClassName('skybox-section'), elZoneBackgroundMode.value == 'skybox'); + showElements(document.getElementsByClassName('atmosphere-section'), elZoneBackgroundMode.value == 'atmosphere'); } if (selected) { @@ -1117,7 +1125,7 @@ -
+
Skybox Color
R
@@ -1125,13 +1133,13 @@
B
-
+
Skybox URL
-
+
Atmosphere Center
X
@@ -1139,31 +1147,31 @@
Z
-
+
Atmosphere Inner Radius
-
+
Atmosphere Outer Radius
-
+
Atmosphere Mie Scattering
-
+
Atmosphere Rayleigh Scattering
-
+
Atmosphere Scattering Wavelenghts
X
@@ -1171,7 +1179,7 @@
Z
-
+