mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 00:56:48 +02:00
remove mouth mode
This commit is contained in:
parent
3e7cc7d6eb
commit
e1e567b1b5
2 changed files with 7 additions and 35 deletions
|
@ -5,9 +5,7 @@
|
|||
// Created by James B. Pollack @imgntn -- 09/03/2015
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// example of a nested entity. it doesn't do much now besides delete itself if it collides with something (bubbles are fragile! it would be cool if it sometimes merged with other bubbbles it hit)
|
||||
// todo: play bubble sounds & particle bursts from the bubble itself instead of the wand.
|
||||
// blocker: needs some sound fixes and a way to find its own position before unload for spatialization
|
||||
// example of a nested entity. plays a particle burst at the location where its deleted.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
// Created by James B. Pollack @imgntn -- 09/03/2015
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Makes bubbles when you wave the object around, or hold it near your mouth and make noise into the microphone.
|
||||
// Makes bubbles when you wave the object around.
|
||||
//
|
||||
// For the example, it's attached to a wand -- but you can attach it to whatever entity you want. I dream of BubbleBees :) bzzzz...pop!
|
||||
//
|
||||
|
@ -14,16 +14,11 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
function convertRange(value, r1, r2) {
|
||||
return (value - r1[0]) * (r2[1] - r2[0]) / (r1[1] - r1[0]) + r2[0];
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
Script.include("../../utilities.js");
|
||||
Script.include("../../libraries/utils.js");
|
||||
|
||||
|
||||
var BUBBLE_MODEL = "http://hifi-public.s3.amazonaws.com/james/bubblewand/models/bubble/bubble.fbx";
|
||||
var BUBBLE_SCRIPT = 'http://hifi-public.s3.amazonaws.com/james/bubblewand/scripts/bubble.js?' + randInt(1, 10000);
|
||||
Script.resolvePath('bubble.js?' + randInt(0, 5000));
|
||||
|
@ -39,7 +34,6 @@ function convertRange(value, r1, r2) {
|
|||
z: 0
|
||||
}
|
||||
|
||||
var MOUTH_MODE_GROWTH_FACTOR = 0.005;
|
||||
var WAVE_MODE_GROWTH_FACTOR = 0.005;
|
||||
var SHRINK_LOWER_LIMIT = 0.02;
|
||||
var SHRINK_FACTOR = 0.001;
|
||||
|
@ -135,9 +129,7 @@ function convertRange(value, r1, r2) {
|
|||
// print('HANDLE GRAB 1')
|
||||
var properties = Entities.getEntityProperties(wandEntity.entityID);
|
||||
var wandPosition = properties.position;
|
||||
//if the wand is in the gust detector, activate mouth mode and change the overlay color
|
||||
var hitTargetWithWand = findSphereSphereHit(wandPosition, HAND_SIZE / 2, getGustDetectorPosition(), TARGET_SIZE / 2)
|
||||
|
||||
|
||||
var velocity = Vec3.subtract(wandPosition, _t.lastPosition)
|
||||
|
||||
// print('VELOCITY:' + JSON.stringify(velocity));
|
||||
|
@ -150,14 +142,6 @@ function convertRange(value, r1, r2) {
|
|||
var wandTipPosition = Vec3.sum(wandPosition, upOffset);
|
||||
_t.wandTipPosition = wandTipPosition;
|
||||
|
||||
var mouthMode;
|
||||
|
||||
if (hitTargetWithWand) {
|
||||
mouthMode = true;
|
||||
} else {
|
||||
mouthMode = false;
|
||||
}
|
||||
|
||||
if (velocityStrength < VELOCITY_STRENGTH_LOWER_LIMIT) {
|
||||
velocityStrength = 0
|
||||
}
|
||||
|
@ -183,9 +167,6 @@ function convertRange(value, r1, r2) {
|
|||
}
|
||||
}
|
||||
|
||||
var volumeLevel = MyAvatar.audioAverageLoudness;
|
||||
//volume numbers are pretty large, so lets scale them down.
|
||||
var convertedVolume = convertRange(volumeLevel, [0, 5000], [0, 10]);
|
||||
|
||||
// default is 'wave mode', where waving the object around grows the bubbles
|
||||
|
||||
|
@ -198,10 +179,8 @@ function convertRange(value, r1, r2) {
|
|||
|
||||
//actually grow the bubble
|
||||
var dimensions = Entities.getEntityProperties(_t.currentBubble).dimensions;
|
||||
var avatarFront = Quat.getFront(MyAvatar.orientation);
|
||||
var forwardOffset = Vec3.multiply(avatarFront, 0.1);
|
||||
|
||||
if (velocityStrength > 1 || convertedVolume > 1) {
|
||||
if (velocityStrength > 1) {
|
||||
|
||||
//add some variation in bubble sizes
|
||||
var bubbleSize = randInt(1, 5);
|
||||
|
@ -213,7 +192,7 @@ function convertRange(value, r1, r2) {
|
|||
var lifetime = randInt(BUBBLE_LIFETIME_MIN, BUBBLE_LIFETIME_MAX);
|
||||
|
||||
Entities.editEntity(_t.currentBubble, {
|
||||
velocity: mouthMode ? avatarFront : velocity,
|
||||
velocity: velocity,
|
||||
lifetime: lifetime
|
||||
});
|
||||
|
||||
|
@ -223,16 +202,11 @@ function convertRange(value, r1, r2) {
|
|||
return
|
||||
} else {
|
||||
|
||||
if (mouthMode) {
|
||||
dimensions.x += WAVE_MODE_GROWTH_FACTOR * convertedVolume;
|
||||
dimensions.y += WAVE_MODE_GROWTH_FACTOR * convertedVolume;
|
||||
dimensions.z += WAVE_MODE_GROWTH_FACTOR * convertedVolume;
|
||||
|
||||
} else {
|
||||
|
||||
dimensions.x += WAVE_MODE_GROWTH_FACTOR * velocityStrength;
|
||||
dimensions.y += WAVE_MODE_GROWTH_FACTOR * velocityStrength;
|
||||
dimensions.z += WAVE_MODE_GROWTH_FACTOR * velocityStrength;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue