From aa2ee2526e05e685792f8903dc884a72edcdf8f0 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 16 Jan 2014 11:51:46 -0800 Subject: [PATCH 1/3] name file correctly --- interface/src/VoxelSystem.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index ce4cb0bce4..a035455d5f 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -1,6 +1,5 @@ // -// Cube.cpp -// interface +// VoxelSystem.cpp // // Created by Philip on 12/31/12. // Copyright (c) 2012 High Fidelity, Inc. All rights reserved. From 5abf61299038aaaa4888b299705a18d078f1e0ab Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Fri, 17 Jan 2014 16:43:43 -0800 Subject: [PATCH 2/3] new sounds for voxelBird, clap scripts --- examples/clap.js | 21 +++++++++++++++++---- examples/playSound.js | 2 +- examples/voxelBird.js | 17 ++++++++++------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/examples/clap.js b/examples/clap.js index 3638d3e589..fdd2b29aa2 100644 --- a/examples/clap.js +++ b/examples/clap.js @@ -1,5 +1,5 @@ // -// This sample script watches your hydra hands and makes clapping sound +// This sample script watches your hydra hands and makes clapping sound when they come close together fast // function length(v) { @@ -17,7 +17,13 @@ function vMinus(a, b) { } // First, load the clap sound from a URL -var clap = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/clap1.raw"); +var clap1 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/claps/clap1.raw"); +var clap2 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/claps/clap2.raw"); +var clap3 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/claps/clap3.raw"); +var clap4 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/claps/clap4.raw"); +var clap5 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/claps/clap5.raw"); +var clap6 = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/claps/clap6.raw"); + var clapping = new Array(); clapping[0] = false; clapping[1] = false; @@ -33,16 +39,23 @@ function maybePlaySound() { var speed = length(palmVelocity); const CLAP_SPEED = 0.2; - const CLAP_DISTANCE = 0.3; + const CLAP_DISTANCE = 0.2; if (!clapping[palm] && (distanceBetween < CLAP_DISTANCE) && (speed > CLAP_SPEED)) { var options = new AudioInjectionOptions();
 options.position = palm1Position; options.volume = speed / 2.0; if (options.volume > 1.0) options.volume = 1.0; + which = Math.floor((Math.random() * 6) + 1); + if (which == 1) { Audio.playSound(clap1, options); } + else if (which == 2) { Audio.playSound(clap2, options); } + else if (which == 3) { Audio.playSound(clap3, options); } + else if (which == 4) { Audio.playSound(clap4, options); } + else if (which == 5) { Audio.playSound(clap5, options); } + else { Audio.playSound(clap6, options); } Audio.playSound(clap, options); clapping[palm] = true; - } else if (clapping[palm] && (speed < (CLAP_SPEED / 1.5))) { + } else if (clapping[palm] && (speed < (CLAP_SPEED / 4.0))) { clapping[palm] = false; } } diff --git a/examples/playSound.js b/examples/playSound.js index 40cd80c3cb..6631d5526a 100644 --- a/examples/playSound.js +++ b/examples/playSound.js @@ -3,7 +3,7 @@ // // First, load the clap sound from a URL -var clap = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/clap1.raw"); +var clap = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw"); function maybePlaySound() { if (Math.random() < 0.01) { diff --git a/examples/voxelBird.js b/examples/voxelBird.js index 52bd06f36b..bc4cac0247 100644 --- a/examples/voxelBird.js +++ b/examples/voxelBird.js @@ -41,16 +41,19 @@ function vInterpolate(a, b, fraction) { // Decide what kind of bird we are var tweet; + var which = Math.random(); -if (which < 1.0) { - tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/bushtit_1.raw"); +if (which < 0.2) { + tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/bushtit_1.raw"); } else if (which < 0.4) { - tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/bushtit_2.raw"); + tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/rosyfacedlovebird.raw"); } else if (which < 0.6) { - tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/bushtit_3.raw"); + tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/saysphoebe.raw"); +} else if (which < 0.8) { + tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw"); } else { - tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/mexicanWhipoorwill.raw"); -} + tweet = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/westernscreechowl.raw"); +} var position = { x: 0, y: 0, z: 0 }; var lastPosition = { x: 0, y: 0, z: 0 }; @@ -58,7 +61,7 @@ var oldPosition = { x: 0, y: 0, z:0 }; var targetPosition = { x: 0, y: 0, z: 0 }; var size = 0.125; -var range = 4.0; // Over what distance in meters do you want your bird to fly around +var range = 50.0; // Over what distance in meters do you want your bird to fly around var color = { r: 100, g: 50, b: 150 }; var colorEdge = { r:255, g:250, b:175 }; var frame = 0; From 4547f07739669c72d96adf62a2491ccae20da88e Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Fri, 17 Jan 2014 17:10:15 -0800 Subject: [PATCH 3/3] added fountain script --- examples/fountain.js | 62 ++++++++++++++++++++++++ interface/src/avatar/MyAvatar.cpp | 2 - interface/src/devices/SixenseManager.cpp | 2 +- 3 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 examples/fountain.js diff --git a/examples/fountain.js b/examples/fountain.js new file mode 100644 index 0000000000..b15557c8ee --- /dev/null +++ b/examples/fountain.js @@ -0,0 +1,62 @@ + + +function vLength(v) { + return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z); +} + +function printVector(v) { + print(v.x + ", " + v.y + ", " + v.z + "\n"); +} + +// Create a random vector with individual lengths between a,b +function randVector(a, b) { + var rval = { x: a + Math.random() * (b - a), y: a + Math.random() * (b - a), z: a + Math.random() * (b - a) }; + return rval; +} + +function vMinus(a, b) { + var rval = { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z }; + return rval; +} + +function vPlus(a, b) { + var rval = { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z }; + return rval; +} + +function vCopy(a, b) { + a.x = b.x; + a.y = b.y; + a.z = b.z; + return; +} + +// Returns a vector which is fraction of the way between a and b +function vInterpolate(a, b, fraction) { + var rval = { x: a.x + (b.x - a.x) * fraction, y: a.y + (b.y - a.y) * fraction, z: a.z + (b.z - a.z) * fraction }; + return rval; +} + +var position = { x: 5.0 / TREE_SCALE, y: 5.0 / TREE_SCALE, z: 5.0 / TREE_SCALE }; +Voxels.queueDestructiveVoxelAdd(position.x, position.y - (1.0 / TREE_SCALE), position.z, 0.5 / TREE_SCALE, 255, 255, 1); + +function makeFountain() { + if (Math.random() < 0.06) { + //print("Made particle!\n"); + + var size = (0.02 + (Math.random() * 0.05)) / TREE_SCALE; + var velocity = { x: (Math.random() * 1.0 - 0.5) / TREE_SCALE, + y: (1.0 + (Math.random() * 2.0)) / TREE_SCALE, + z: (Math.random() * 1.0 - 0.5) / TREE_SCALE }; + + var gravity = { x: 0, y: -0.5 / TREE_SCALE, z: 0 }; // gravity has no effect on these bullets + var color = { red: 0, green: 0, blue: 128 }; + var damping = 0.25; // no damping + var inHand = false; + var script = ""; + + Particles.queueParticleAdd(position, size, color, velocity, gravity, damping, inHand, script); + } +} +// register the call back so it fires before each data send +Agent.willSendVisualDataCallback.connect(makeFountain); \ No newline at end of file diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 3c5fdb243f..3bbba8b749 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -175,8 +175,6 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) { // Compute instantaneous acceleration float forwardAcceleration = glm::length(glm::dot(getBodyFrontDirection(), getVelocity() - oldVelocity)) / deltaTime; - const float ACCELERATION_PITCH_DECAY = 0.4f; - const float ACCELERATION_PULL_THRESHOLD = 0.2f; const float OCULUS_ACCELERATION_PULL_THRESHOLD = 1.0f; const int OCULUS_YAW_OFFSET_THRESHOLD = 10; diff --git a/interface/src/devices/SixenseManager.cpp b/interface/src/devices/SixenseManager.cpp index 12d045dea3..af1eafc85b 100644 --- a/interface/src/devices/SixenseManager.cpp +++ b/interface/src/devices/SixenseManager.cpp @@ -119,7 +119,7 @@ void SixenseManager::update(float deltaTime) { FingerData finger(palm, &hand); finger.setActive(true); finger.setRawRootPosition(position); - const float FINGER_LENGTH = 150.0f; // Millimeters + const float FINGER_LENGTH = 300.0f; // Millimeters const glm::vec3 FINGER_VECTOR(0.0f, 0.0f, FINGER_LENGTH); const glm::vec3 newTipPosition = position + rotation * FINGER_VECTOR; finger.setRawTipPosition(position + rotation * FINGER_VECTOR);