From 63c1bdd0a820be724d0939fc235ded7c23c9c1ca Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Mon, 30 Mar 2015 17:03:09 -0700 Subject: [PATCH] Fix error with angular speed --- examples/dice.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/dice.js b/examples/dice.js index b0021ecebb..2aefcf90fe 100644 --- a/examples/dice.js +++ b/examples/dice.js @@ -45,6 +45,9 @@ var diceButton = Overlays.addOverlay("image", { var GRAVITY = -3.5; var LIFETIME = 300; +// NOTE: angularVelocity is in radians/sec +var MAX_ANGULAR_SPEED = Math.PI; + function shootDice(position, velocity) { for (var i = 0; i < NUMBER_OF_DICE; i++) { dice.push(Entities.addEntity( @@ -53,9 +56,7 @@ function shootDice(position, velocity) { position: position, velocity: velocity, rotation: Quat.fromPitchYawRollDegrees(Math.random() * 360, Math.random() * 360, Math.random() * 360), - // NOTE: angularVelocity is in radians/sec - var maxAngularSpeed = Math.PI; - angularVelocity: { x: Math.random() * maxAngularSpeed, y: Math.random() * maxAngularSpeed, z: Math.random() * maxAngularSpeed }, + angularVelocity: { x: Math.random() * MAX_ANGULAR_SPEED, y: Math.random() * MAX_ANGULAR_SPEED, z: Math.random() * MAX_ANGULAR_SPEED }, lifetime: LIFETIME, gravity: { x: 0, y: GRAVITY, z: 0 }, shapeType: "box",