mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:38:02 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into web-scripts-use-local-libs
This commit is contained in:
commit
a9897f1cc4
35 changed files with 775 additions and 237 deletions
|
@ -325,14 +325,21 @@ void AssetClient::handleAssetGetReply(QSharedPointer<ReceivedMessage> message, S
|
||||||
|
|
||||||
// Check if we have any pending requests for this node
|
// Check if we have any pending requests for this node
|
||||||
auto messageMapIt = _pendingRequests.find(senderNode);
|
auto messageMapIt = _pendingRequests.find(senderNode);
|
||||||
if (messageMapIt != _pendingRequests.end()) {
|
if (messageMapIt == _pendingRequests.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Found the node, get the MessageID -> Callback map
|
// Found the node, get the MessageID -> Callback map
|
||||||
auto& messageCallbackMap = messageMapIt->second;
|
auto& messageCallbackMap = messageMapIt->second;
|
||||||
|
|
||||||
// Check if we have this pending request
|
// Check if we have this pending request
|
||||||
auto requestIt = messageCallbackMap.find(messageID);
|
auto requestIt = messageCallbackMap.find(messageID);
|
||||||
if (requestIt != messageCallbackMap.end()) {
|
if (requestIt == messageCallbackMap.end()) {
|
||||||
|
// Although the messageCallbackMap may now be empty, we won't delete the node until we have disconnected from
|
||||||
|
// it to avoid constantly creating/deleting the map on subsequent requests.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto& callbacks = requestIt->second;
|
auto& callbacks = requestIt->second;
|
||||||
|
|
||||||
// Store message in case we need to disconnect from it later.
|
// Store message in case we need to disconnect from it later.
|
||||||
|
@ -342,10 +349,79 @@ void AssetClient::handleAssetGetReply(QSharedPointer<ReceivedMessage> message, S
|
||||||
callbacks.completeCallback(true, error, message->readAll());
|
callbacks.completeCallback(true, error, message->readAll());
|
||||||
messageCallbackMap.erase(requestIt);
|
messageCallbackMap.erase(requestIt);
|
||||||
} else {
|
} else {
|
||||||
connect(message.data(), &ReceivedMessage::progress, this, [this, length, message, &callbacks]() {
|
auto weakNode = senderNode.toWeakRef();
|
||||||
callbacks.progressCallback(message->getSize(), length);
|
|
||||||
|
connect(message.data(), &ReceivedMessage::progress, this, [this, weakNode, messageID, length]() {
|
||||||
|
handleProgressCallback(weakNode, messageID, length);
|
||||||
});
|
});
|
||||||
connect(message.data(), &ReceivedMessage::completed, this, [this, messageID, message, &messageCallbackMap, &callbacks]() {
|
connect(message.data(), &ReceivedMessage::completed, this, [this, weakNode, messageID]() {
|
||||||
|
handleCompleteCallback(weakNode, messageID);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssetClient::handleProgressCallback(const QWeakPointer<Node>& node, MessageID messageID, DataOffset length) {
|
||||||
|
auto senderNode = node.toStrongRef();
|
||||||
|
|
||||||
|
if (!senderNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we have any pending requests for this node
|
||||||
|
auto messageMapIt = _pendingRequests.find(senderNode);
|
||||||
|
if (messageMapIt == _pendingRequests.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Found the node, get the MessageID -> Callback map
|
||||||
|
auto& messageCallbackMap = messageMapIt->second;
|
||||||
|
|
||||||
|
// Check if we have this pending request
|
||||||
|
auto requestIt = messageCallbackMap.find(messageID);
|
||||||
|
if (requestIt == messageCallbackMap.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& callbacks = requestIt->second;
|
||||||
|
auto& message = callbacks.message;
|
||||||
|
|
||||||
|
if (!message) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
callbacks.progressCallback(message->getSize(), length);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AssetClient::handleCompleteCallback(const QWeakPointer<Node>& node, MessageID messageID) {
|
||||||
|
auto senderNode = node.toStrongRef();
|
||||||
|
|
||||||
|
if (!senderNode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we have any pending requests for this node
|
||||||
|
auto messageMapIt = _pendingRequests.find(senderNode);
|
||||||
|
if (messageMapIt == _pendingRequests.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Found the node, get the MessageID -> Callback map
|
||||||
|
auto& messageCallbackMap = messageMapIt->second;
|
||||||
|
|
||||||
|
// Check if we have this pending request
|
||||||
|
auto requestIt = messageCallbackMap.find(messageID);
|
||||||
|
if (requestIt == messageCallbackMap.end()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& callbacks = requestIt->second;
|
||||||
|
auto& message = callbacks.message;
|
||||||
|
|
||||||
|
if (!message) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (message->failed()) {
|
if (message->failed()) {
|
||||||
callbacks.completeCallback(false, AssetServerError::NoError, QByteArray());
|
callbacks.completeCallback(false, AssetServerError::NoError, QByteArray());
|
||||||
} else {
|
} else {
|
||||||
|
@ -357,14 +433,8 @@ void AssetClient::handleAssetGetReply(QSharedPointer<ReceivedMessage> message, S
|
||||||
// had been canceled, we should have been disconnected from the ReceivedMessage
|
// had been canceled, we should have been disconnected from the ReceivedMessage
|
||||||
// signals and thus never had this lambda called.
|
// signals and thus never had this lambda called.
|
||||||
messageCallbackMap.erase(messageID);
|
messageCallbackMap.erase(messageID);
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Although the messageCallbackMap may now be empty, we won't delete the node until we have disconnected from
|
|
||||||
// it to avoid constantly creating/deleting the map on subsequent requests.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageID AssetClient::getAssetMapping(const AssetPath& path, MappingOperationCallback callback) {
|
MessageID AssetClient::getAssetMapping(const AssetPath& path, MappingOperationCallback callback) {
|
||||||
Q_ASSERT(QThread::currentThread() == thread());
|
Q_ASSERT(QThread::currentThread() == thread());
|
||||||
|
|
|
@ -93,6 +93,9 @@ private:
|
||||||
bool cancelGetAssetRequest(MessageID id);
|
bool cancelGetAssetRequest(MessageID id);
|
||||||
bool cancelUploadAssetRequest(MessageID id);
|
bool cancelUploadAssetRequest(MessageID id);
|
||||||
|
|
||||||
|
void handleProgressCallback(const QWeakPointer<Node>& node, MessageID messageID, DataOffset length);
|
||||||
|
void handleCompleteCallback(const QWeakPointer<Node>& node, MessageID messageID);
|
||||||
|
|
||||||
struct GetAssetRequestData {
|
struct GetAssetRequestData {
|
||||||
QSharedPointer<ReceivedMessage> message;
|
QSharedPointer<ReceivedMessage> message;
|
||||||
ReceivedAssetCallback completeCallback;
|
ReceivedAssetCallback completeCallback;
|
||||||
|
|
|
@ -31,7 +31,8 @@ var BUTTON_SIZE = 32;
|
||||||
var PADDING = 3;
|
var PADDING = 3;
|
||||||
|
|
||||||
//a helper library for creating toolbars
|
//a helper library for creating toolbars
|
||||||
Script.include(["../default/libraries/toolBars.js"]);
|
Script.include("http://hifi-production.s3.amazonaws.com/tutorials/dice/toolBars.js");
|
||||||
|
|
||||||
var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.dice.toolbar", function(screenSize) {
|
var toolBar = new ToolBar(0, 0, ToolBar.HORIZONTAL, "highfidelity.dice.toolbar", function(screenSize) {
|
||||||
return {
|
return {
|
||||||
x: (screenSize.x / 2 - BUTTON_SIZE * 2 + PADDING),
|
x: (screenSize.x / 2 - BUTTON_SIZE * 2 + PADDING),
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
var soundMap = [{
|
var soundMap = [{
|
||||||
name: 'river water',
|
name: 'river water',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/Water_Lap_River_Edge_Gentle.L.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Water_Lap_River_Edge_Gentle.L.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 580,
|
x: 580,
|
||||||
|
@ -22,7 +22,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'windmill',
|
name: 'windmill',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/WINDMILL_Mono.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/WINDMILL_Mono.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 530,
|
x: 530,
|
||||||
|
@ -34,7 +34,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'insects',
|
name: 'insects',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/insects3.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/insects3.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 560,
|
x: 560,
|
||||||
|
@ -46,7 +46,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'fireplace',
|
name: 'fireplace',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/demo/0619_Fireplace__Tree_B.L.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/0619_Fireplace__Tree_B.L.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 551.61,
|
x: 551.61,
|
||||||
|
@ -58,7 +58,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'cat purring',
|
name: 'cat purring',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/Cat_Purring_Deep_Low_Snor.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/Cat_Purring_Deep_Low_Snor.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 551.48,
|
x: 551.48,
|
||||||
|
@ -70,7 +70,7 @@ var soundMap = [{
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
name: 'dogs barking',
|
name: 'dogs barking',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/dogs_barking_1.L.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/dogs_barking_1.L.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 523,
|
x: 523,
|
||||||
|
@ -83,7 +83,7 @@ var soundMap = [{
|
||||||
playAtInterval: 60 * 1000
|
playAtInterval: 60 * 1000
|
||||||
}, {
|
}, {
|
||||||
name: 'arcade game',
|
name: 'arcade game',
|
||||||
url: "http://hifi-public.s3.amazonaws.com/ryan/ARCADE_GAMES_VID.L.L.wav",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/sounds/ARCADE_GAMES_VID.L.L.wav",
|
||||||
audioOptions: {
|
audioOptions: {
|
||||||
position: {
|
position: {
|
||||||
x: 543.77,
|
x: 543.77,
|
||||||
|
|
|
@ -6,12 +6,10 @@
|
||||||
//
|
//
|
||||||
// This is a script that creates a persistent basketball hoop with a working collision hull. Feel free to move it.
|
// This is a script that creates a persistent basketball hoop with a working collision hull. Feel free to move it.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
|
||||||
|
|
||||||
var hoopURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop.fbx";
|
|
||||||
var hoopCollisionHullURL = "http://hifi-public.s3.amazonaws.com/models/basketball_hoop/basketball_hoop_collision_hull.obj";
|
var hoopURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop.fbx";
|
||||||
|
var hoopCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_hoop_collision_hull.obj";
|
||||||
|
|
||||||
var hoopStartPosition =
|
var hoopStartPosition =
|
||||||
Vec3.sum(MyAvatar.position,
|
Vec3.sum(MyAvatar.position,
|
||||||
|
|
|
@ -8,15 +8,13 @@
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
|
||||||
Script.include("../../libraries/utils.js");
|
|
||||||
|
|
||||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
Script.include("libraries/utils.js");
|
||||||
|
|
||||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||||
var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||||
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
|
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
|
||||||
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
|
var rackCollisionHullURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
|
||||||
var NUMBER_OF_BALLS = 4;
|
var NUMBER_OF_BALLS = 4;
|
||||||
var DIAMETER = 0.30;
|
var DIAMETER = 0.30;
|
||||||
var RESET_DISTANCE = 1;
|
var RESET_DISTANCE = 1;
|
||||||
|
|
|
@ -9,10 +9,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|
||||||
|
|
||||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||||
var collisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
var collisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||||
|
|
||||||
|
|
||||||
var basketball = null;
|
var basketball = null;
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
@ -42,8 +41,8 @@ var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
createBasketballs: function() {
|
createBasketballs: function() {
|
||||||
var NUMBER_OF_BALLS = 4;
|
var NUMBER_OF_BALLS = 4;
|
||||||
var DIAMETER = 0.30;
|
var DIAMETER = 0.30;
|
||||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
var basketballURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||||
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
var basketballCollisionSoundURL ="http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||||
|
|
||||||
var position = {
|
var position = {
|
||||||
x: 542.86,
|
x: 542.86,
|
|
@ -11,12 +11,12 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
|
|
||||||
var NOTCH_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/notch.wav';
|
var NOTCH_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/notch.wav';
|
||||||
var SHOOT_ARROW_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/String_release2.L.wav';
|
var SHOOT_ARROW_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/String_release2.L.wav';
|
||||||
var STRING_PULL_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Bow_draw.1.L.wav';
|
var STRING_PULL_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Bow_draw.1.L.wav';
|
||||||
var ARROW_HIT_SOUND_URL = 'http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/sounds/Arrow_impact1.L.wav'
|
var ARROW_HIT_SOUND_URL = 'https://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/Arrow_impact1.L.wav'
|
||||||
|
|
||||||
var ARROW_DIMENSIONS = {
|
var ARROW_DIMENSIONS = {
|
||||||
x: 0.02,
|
x: 0.02,
|
||||||
|
@ -32,9 +32,9 @@
|
||||||
z: 0
|
z: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
var ARROW_MODEL_URL = "http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_textured.fbx";
|
var ARROW_MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_textured.fbx";
|
||||||
var ARROW_COLLISION_HULL_URL =
|
var ARROW_COLLISION_HULL_URL =
|
||||||
"http://hifi-content.s3.amazonaws.com/james/bow_and_arrow/models/newarrow_collision_hull.obj";
|
"http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/newarrow_collision_hull.obj";
|
||||||
|
|
||||||
var ARROW_DIMENSIONS = {
|
var ARROW_DIMENSIONS = {
|
||||||
x: 0.02,
|
x: 0.02,
|
||||||
|
|
|
@ -10,13 +10,13 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
var utilsPath = Script.resolvePath('../../libraries/utils.js');
|
var utilsPath = Script.resolvePath('libraries/utils.js');
|
||||||
Script.include(utilsPath);
|
Script.include(utilsPath);
|
||||||
|
|
||||||
var SCRIPT_URL = Script.resolvePath('bow.js');
|
var SCRIPT_URL = Script.resolvePath('bow.js');
|
||||||
|
|
||||||
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
|
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
|
||||||
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
|
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
|
||||||
var BOW_DIMENSIONS = {
|
var BOW_DIMENSIONS = {
|
||||||
x: 0.04,
|
x: 0.04,
|
||||||
y: 1.3,
|
y: 1.3,
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
|
|
||||||
var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx';
|
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
|
||||||
var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj';
|
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
|
||||||
|
|
||||||
var WAND_SCRIPT_URL = Script.resolvePath("wand.js");
|
var WAND_SCRIPT_URL = Script.resolvePath("wand.js");
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
|
|
||||||
var BUBBLE_MODEL = "http://hifi-content.s3.amazonaws.com/james/bubblewand/bubble.fbx";
|
var BUBBLE_MODEL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/bubble.fbx";
|
||||||
|
|
||||||
var BUBBLE_INITIAL_DIMENSIONS = {
|
var BUBBLE_INITIAL_DIMENSIONS = {
|
||||||
x: 0.01,
|
x: 0.01,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
var _this;
|
var _this;
|
||||||
Cat = function() {
|
Cat = function() {
|
||||||
_this = this;
|
_this = this;
|
||||||
this.meowSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Animals/cat_meow.wav");
|
this.meowSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/cat_meow.wav");
|
||||||
};
|
};
|
||||||
|
|
||||||
Cat.prototype = {
|
Cat.prototype = {
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
|
|
||||||
function createDoll() {
|
function createDoll() {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
|
||||||
|
|
||||||
var scriptURL = Script.resolvePath("doll.js");
|
var scriptURL = Script.resolvePath("doll.js");
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
var _this;
|
var _this;
|
||||||
// this is the "constructor" for the entity as a JS object we don't do much here
|
// this is the "constructor" for the entity as a JS object we don't do much here
|
||||||
var Doll = function() {
|
var Doll = function() {
|
||||||
_this = this;
|
_this = this;
|
||||||
this.screamSounds = [SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/KenDoll_1%2303.wav")];
|
this.screamSounds = [SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/KenDoll_1%2303.wav")];
|
||||||
};
|
};
|
||||||
|
|
||||||
Doll.prototype = {
|
Doll.prototype = {
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
Entities.editEntity(this.entityID, {
|
Entities.editEntity(this.entityID, {
|
||||||
animation: {
|
animation: {
|
||||||
url: "https://hifi-public.s3.amazonaws.com/models/Bboys/zombie_scream.fbx",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/zombie_scream.fbx",
|
||||||
running: true
|
running: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
var yVelocity = 0.0;
|
var yVelocity = 0.0;
|
||||||
var yAcceleration = -G;
|
var yAcceleration = -G;
|
||||||
|
|
||||||
var airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Air Swipe 05.wav");
|
var airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Air%20Swipe%2005.wav");
|
||||||
var injector = null;
|
var injector = null;
|
||||||
|
|
||||||
this.position = function() {
|
this.position = function() {
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: MyAvatar.skeletonModelURL,
|
modelURL: MyAvatar.skeletonModelURL,
|
||||||
animation: {
|
animation: {
|
||||||
url: "http://hifi-content.s3.amazonaws.com/ozan/dev/anim/standard_anims_160127/fly.fbx",
|
url: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/fly.fbx",
|
||||||
running: true,
|
running: true,
|
||||||
fps: 30,
|
fps: 30,
|
||||||
firstFrame: 1.0,
|
firstFrame: 1.0,
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
animation: {running: false}
|
animation: {running: false}
|
||||||
});
|
});
|
||||||
|
|
||||||
airSwipeSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/8bit Jump 03.wav");
|
airSwipeSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/8bit%20Jump%2003.wav");
|
||||||
injector = null;
|
injector = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@
|
||||||
|
|
||||||
var id = entityManager.add({
|
var id = entityManager.add({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/coin.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/coin.fbx",
|
||||||
angularVelocity: { x: 0, y: 20, z: 0 },
|
angularVelocity: { x: 0, y: 20, z: 0 },
|
||||||
position: to3DPosition(this.position()),
|
position: to3DPosition(this.position()),
|
||||||
dimensions:dimensions
|
dimensions:dimensions
|
||||||
|
@ -172,14 +172,14 @@
|
||||||
|
|
||||||
var idUp = entityManager.add({
|
var idUp = entityManager.add({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx",
|
||||||
rotation: Quat.fromPitchYawRollDegrees(180, 0, 0),
|
rotation: Quat.fromPitchYawRollDegrees(180, 0, 0),
|
||||||
position: to3DPosition({ x: xPosition, y: upYPosition }),
|
position: to3DPosition({ x: xPosition, y: upYPosition }),
|
||||||
dimensions: { x: width, y: upHeight, z: width }
|
dimensions: { x: width, y: upHeight, z: width }
|
||||||
});
|
});
|
||||||
var idDown = entityManager.add({
|
var idDown = entityManager.add({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/greenPipe.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/greenPipe.fbx",
|
||||||
position: to3DPosition({ x: xPosition, y: height / 2.0 }),
|
position: to3DPosition({ x: xPosition, y: height / 2.0 }),
|
||||||
dimensions: { x: width, y: height, z: width }
|
dimensions: { x: width, y: height, z: width }
|
||||||
});
|
});
|
||||||
|
@ -217,7 +217,7 @@
|
||||||
var pipes = new Array();
|
var pipes = new Array();
|
||||||
var coins = new Array();
|
var coins = new Array();
|
||||||
|
|
||||||
var coinsSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Coin.wav");
|
var coinsSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Coin.wav");
|
||||||
var injector = null;
|
var injector = null;
|
||||||
|
|
||||||
this.update = function(deltaTime, gameTime, startedPlaying) {
|
this.update = function(deltaTime, gameTime, startedPlaying) {
|
||||||
|
@ -325,7 +325,7 @@
|
||||||
var numberDimensions = { x: 0.0660, y: 0.1050, z: 0.0048 };
|
var numberDimensions = { x: 0.0660, y: 0.1050, z: 0.0048 };
|
||||||
|
|
||||||
function numberUrl(number) {
|
function numberUrl(number) {
|
||||||
return "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/" + number + ".fbx"
|
return "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/" + number + ".fbx"
|
||||||
}
|
}
|
||||||
function digitPosition(digit) {
|
function digitPosition(digit) {
|
||||||
return Vec3.multiplyQbyV(space.orientation, { x: 0.3778 + digit * (numberDimensions.x + 0.01), y: 0.0, z: 0.0 });
|
return Vec3.multiplyQbyV(space.orientation, { x: 0.3778 + digit * (numberDimensions.x + 0.01), y: 0.0, z: 0.0 });
|
||||||
|
@ -341,7 +341,7 @@
|
||||||
|
|
||||||
var bestId = entityManager.add({
|
var bestId = entityManager.add({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/best.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/best.fbx",
|
||||||
position: topLeft,
|
position: topLeft,
|
||||||
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
|
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
|
||||||
dimensions: { x: 0.2781, y: 0.0063, z: 0.1037 }
|
dimensions: { x: 0.2781, y: 0.0063, z: 0.1037 }
|
||||||
|
@ -359,7 +359,7 @@
|
||||||
|
|
||||||
var scoreId = entityManager.add({
|
var scoreId = entityManager.add({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/score.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/score.fbx",
|
||||||
position: bottomLeft,
|
position: bottomLeft,
|
||||||
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
|
rotation: Quat.multiply(space.orientation, Quat.fromPitchYawRollDegrees(90, 0, 0)),
|
||||||
dimensions: { x: 0.3678, y: 0.0063, z: 0.1037 }
|
dimensions: { x: 0.3678, y: 0.0063, z: 0.1037 }
|
||||||
|
@ -453,7 +453,7 @@
|
||||||
var pipes = null;
|
var pipes = null;
|
||||||
var score = null;
|
var score = null;
|
||||||
|
|
||||||
var gameOverSound = SoundCache.getSound("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/Game Over.wav");
|
var gameOverSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/Game%20Over.wav");
|
||||||
var injector = null;
|
var injector = null;
|
||||||
|
|
||||||
var directions = ["UP", "DOWN", "LEFT", "RIGHT"];
|
var directions = ["UP", "DOWN", "LEFT", "RIGHT"];
|
||||||
|
@ -466,7 +466,7 @@
|
||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
if (current === sequence.length) {
|
if (current === sequence.length) {
|
||||||
avatar.changeModel("https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/mario.fbx");
|
avatar.changeModel("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/mario.fbx");
|
||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"dynamic": 1,
|
"dynamic": 1,
|
||||||
"id": "{ee5b25e6-aca2-4dc7-9462-51537d89c126}",
|
"id": "{ee5b25e6-aca2-4dc7-9462-51537d89c126}",
|
||||||
"modelURL": "https://s3-us-west-1.amazonaws.com/hifi-content/clement/production/cube.fbx",
|
"modelURL": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/cube.fbx",
|
||||||
"queryAACube": {
|
"queryAACube": {
|
||||||
"scale": 0.5974045991897583,
|
"scale": 0.5974045991897583,
|
||||||
"x": -5.1575918197631836,
|
"x": -5.1575918197631836,
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
"y": -0.13279926776885986,
|
"y": -0.13279926776885986,
|
||||||
"z": 0.34688329696655273
|
"z": 0.34688329696655273
|
||||||
},
|
},
|
||||||
"script": "https://raw.githubusercontent.com/Atlante45/hifi/feat/hackaton/examples/toybox/flappyAvatars/flappyAvatars.js",
|
"script": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flappyAvatars/flappyAvatars.js",
|
||||||
"scriptTimestamp": 1457031937425,
|
"scriptTimestamp": 1457031937425,
|
||||||
"shapeType": "box",
|
"shapeType": "box",
|
||||||
"type": "Model",
|
"type": "Model",
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
|
|
||||||
var scriptURL = Script.resolvePath('flashlight.js');
|
var scriptURL = Script.resolvePath('flashlight.js');
|
||||||
|
|
||||||
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
|
||||||
|
|
||||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
|
|
||||||
var ON_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_on.wav';
|
var ON_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_on.wav';
|
||||||
var OFF_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/flashlight_off.wav';
|
var OFF_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_off.wav';
|
||||||
|
|
||||||
//we are creating lights that we don't want to get stranded so lets make sure that we can get rid of them
|
//we are creating lights that we don't want to get stranded so lets make sure that we can get rid of them
|
||||||
var startTime = Date.now();
|
var startTime = Date.now();
|
||||||
|
|
|
@ -0,0 +1,163 @@
|
||||||
|
// raveStickEntityScript.js
|
||||||
|
//
|
||||||
|
// Script Type: Entity
|
||||||
|
// Created by Eric Levin on 12/16/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// This entity script create light trails on a given object as it moves.
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
var _this;
|
||||||
|
var LIFETIME = 6000;
|
||||||
|
var DRAWING_DEPTH = 0.8;
|
||||||
|
var LINE_DIMENSIONS = 100;
|
||||||
|
var MAX_POINTS_PER_LINE = 50;
|
||||||
|
var MIN_POINT_DISTANCE = 0.02;
|
||||||
|
var STROKE_WIDTH = 0.05
|
||||||
|
var ugLSD = 35;
|
||||||
|
var RaveStick = function() {
|
||||||
|
_this = this;
|
||||||
|
this.colorPalette = [{
|
||||||
|
red: 0,
|
||||||
|
green: 200,
|
||||||
|
blue: 40
|
||||||
|
}, {
|
||||||
|
red: 200,
|
||||||
|
green: 10,
|
||||||
|
blue: 40
|
||||||
|
}];
|
||||||
|
var texture = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/trails.png";
|
||||||
|
this.trail = Entities.addEntity({
|
||||||
|
type: "PolyLine",
|
||||||
|
dimensions: {
|
||||||
|
x: LINE_DIMENSIONS,
|
||||||
|
y: LINE_DIMENSIONS,
|
||||||
|
z: LINE_DIMENSIONS
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
red: 255,
|
||||||
|
green: 255,
|
||||||
|
blue: 255
|
||||||
|
},
|
||||||
|
textures: texture,
|
||||||
|
lifetime: LIFETIME
|
||||||
|
});
|
||||||
|
|
||||||
|
this.points = [];
|
||||||
|
this.normals = [];
|
||||||
|
this.strokeWidths = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
RaveStick.prototype = {
|
||||||
|
isGrabbed: false,
|
||||||
|
|
||||||
|
startNearGrab: function() {
|
||||||
|
this.trailBasePosition = Entities.getEntityProperties(this.entityID, "position").position;
|
||||||
|
Entities.editEntity(this.trail, {
|
||||||
|
position: this.trailBasePosition
|
||||||
|
});
|
||||||
|
this.points = [];
|
||||||
|
this.normals = [];
|
||||||
|
this.strokeWidths = [];
|
||||||
|
this.setupEraseInterval();
|
||||||
|
},
|
||||||
|
|
||||||
|
continueNearGrab: function() {
|
||||||
|
var props = Entities.getEntityProperties(this.entityID, ["position", "rotation"]);
|
||||||
|
var forwardVec = Quat.getFront(Quat.multiply(props.rotation, Quat.fromPitchYawRollDegrees(-90, 0, 0)));
|
||||||
|
forwardVec = Vec3.normalize(forwardVec);
|
||||||
|
var forwardQuat = orientationOf(forwardVec);
|
||||||
|
var position = Vec3.sum(props.position, Vec3.multiply(Quat.getFront(props.rotation), 0.04));
|
||||||
|
var localPoint = Vec3.subtract(position, this.trailBasePosition);
|
||||||
|
if (this.points.length >= 1 && Vec3.distance(localPoint, this.points[this.points.length - 1]) < MIN_POINT_DISTANCE) {
|
||||||
|
//Need a minimum distance to avoid binormal NANs
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.points.length === MAX_POINTS_PER_LINE) {
|
||||||
|
this.points.shift();
|
||||||
|
this.normals.shift();
|
||||||
|
this.strokeWidths.shift();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.points.push(localPoint);
|
||||||
|
var normal = Quat.getUp(props.rotation);
|
||||||
|
this.normals.push(normal);
|
||||||
|
this.strokeWidths.push(STROKE_WIDTH);
|
||||||
|
Entities.editEntity(this.trail, {
|
||||||
|
linePoints: this.points,
|
||||||
|
normals: this.normals,
|
||||||
|
strokeWidths: this.strokeWidths
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
setupEraseInterval: function() {
|
||||||
|
this.trailEraseInterval = Script.setInterval(function() {
|
||||||
|
if (_this.points.length > 0) {
|
||||||
|
_this.points.shift();
|
||||||
|
_this.normals.shift();
|
||||||
|
_this.strokeWidths.shift();
|
||||||
|
Entities.editEntity(_this.trail, {
|
||||||
|
linePoints: _this.points,
|
||||||
|
strokeWidths: _this.strokeWidths,
|
||||||
|
normals: _this.normals
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, ugLSD);
|
||||||
|
},
|
||||||
|
|
||||||
|
releaseGrab: function() {
|
||||||
|
if (!this.trailEraseInterval) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Script.setTimeout(function() {
|
||||||
|
Script.clearInterval(_this.trailEraseInterval);
|
||||||
|
_this.trailEraseInterval = null;
|
||||||
|
}, 3000);
|
||||||
|
},
|
||||||
|
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
},
|
||||||
|
|
||||||
|
unload: function() {
|
||||||
|
Entities.deleteEntity(this.beam);
|
||||||
|
Entities.deleteEntity(this.trail);
|
||||||
|
if (this.trailEraseInterval) {
|
||||||
|
Script.clearInterval(this.trailEraseInterval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
orientationOf = function(vector) {
|
||||||
|
var Y_AXIS = {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
var X_AXIS = {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var theta = 0.0;
|
||||||
|
|
||||||
|
var RAD_TO_DEG = 180.0 / Math.PI;
|
||||||
|
var direction, yaw, pitch;
|
||||||
|
direction = Vec3.normalize(vector);
|
||||||
|
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
||||||
|
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
||||||
|
return Quat.multiply(yaw, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
function computeNormal(p1, p2) {
|
||||||
|
return Vec3.normalize(Vec3.subtract(p2, p1));
|
||||||
|
}
|
||||||
|
return new RaveStick();
|
||||||
|
});
|
|
@ -12,19 +12,22 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
|
var utilitiesScript = Script.resolvePath("libraries/utils.js");
|
||||||
|
Script.include(utilitiesScript);
|
||||||
|
|
||||||
var _this;
|
var _this;
|
||||||
|
|
||||||
var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js");
|
var gunScriptURL = Script.resolvePath("pistol/pistol.js");
|
||||||
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js");
|
||||||
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
var catScriptURL = Script.resolvePath("cat/cat.js");
|
||||||
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js');
|
||||||
var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js');
|
var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js');
|
||||||
var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js");
|
var wandScriptURL = Script.resolvePath("bubblewand/wand.js");
|
||||||
var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js");
|
var dollScriptURL = Script.resolvePath("doll/doll.js");
|
||||||
var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js");
|
var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js");
|
||||||
var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js');
|
var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js');
|
||||||
var bowScriptURL = Script.resolvePath('../examples/toybox/bow/bow.js');
|
var bowScriptURL = Script.resolvePath('bow/bow.js');
|
||||||
var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js");
|
var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js");
|
||||||
var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js');
|
var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js');
|
||||||
var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
||||||
|
|
||||||
|
@ -60,7 +63,6 @@
|
||||||
MasterReset = function() {
|
MasterReset = function() {
|
||||||
var resetKey = "resetMe";
|
var resetKey = "resetMe";
|
||||||
|
|
||||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|
||||||
|
|
||||||
var shouldDeleteOnEndScript = false;
|
var shouldDeleteOnEndScript = false;
|
||||||
|
|
||||||
|
@ -168,7 +170,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRaveStick(position) {
|
function createRaveStick(position) {
|
||||||
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx";
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
var stick = Entities.addEntity({
|
var stick = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -258,7 +260,7 @@
|
||||||
alphaSpread: 0.1,
|
alphaSpread: 0.1,
|
||||||
alphaStart: 0.1,
|
alphaStart: 0.1,
|
||||||
alphaFinish: 0.1,
|
alphaFinish: 0.1,
|
||||||
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png",
|
||||||
emitterShouldTrail: false,
|
emitterShouldTrail: false,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
resetMe: {
|
resetMe: {
|
||||||
|
@ -270,7 +272,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGun(position) {
|
function createGun(position) {
|
||||||
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
|
||||||
|
|
||||||
var pistol = Entities.addEntity({
|
var pistol = Entities.addEntity({
|
||||||
type: 'Model',
|
type: 'Model',
|
||||||
|
@ -279,7 +281,7 @@
|
||||||
position: position,
|
position: position,
|
||||||
restitution: 0,
|
restitution: 0,
|
||||||
damping: 0.5,
|
damping: 0.5,
|
||||||
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
|
||||||
dimensions: {
|
dimensions: {
|
||||||
x: 0.05,
|
x: 0.05,
|
||||||
y: 0.23,
|
y: 0.23,
|
||||||
|
@ -343,8 +345,8 @@
|
||||||
|
|
||||||
var SCRIPT_URL = Script.resolvePath('bow.js');
|
var SCRIPT_URL = Script.resolvePath('bow.js');
|
||||||
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
|
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
|
||||||
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
|
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
|
||||||
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
|
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
|
||||||
|
|
||||||
var BOW_DIMENSIONS = {
|
var BOW_DIMENSIONS = {
|
||||||
x: 0.04,
|
x: 0.04,
|
||||||
|
@ -496,7 +498,7 @@
|
||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
name: "fire",
|
name: "fire",
|
||||||
animationSettings: animationSettings,
|
animationSettings: animationSettings,
|
||||||
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png",
|
||||||
position: {
|
position: {
|
||||||
x: 551.45,
|
x: 551.45,
|
||||||
y: 494.82,
|
y: 494.82,
|
||||||
|
@ -559,10 +561,10 @@
|
||||||
var DIAMETER = 0.30;
|
var DIAMETER = 0.30;
|
||||||
var RESET_DISTANCE = 1;
|
var RESET_DISTANCE = 1;
|
||||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||||
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||||
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
|
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
|
||||||
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
|
var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
|
||||||
|
|
||||||
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
||||||
|
|
||||||
|
@ -638,7 +640,7 @@
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
|
collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav',
|
||||||
collisionless: false,
|
collisionless: false,
|
||||||
modelURL: basketballURL,
|
modelURL: basketballURL,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
|
@ -733,8 +735,8 @@
|
||||||
|
|
||||||
function createTargets() {
|
function createTargets() {
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||||
|
|
||||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||||
var RESET_DISTANCE = 0.5;
|
var RESET_DISTANCE = 0.5;
|
||||||
|
@ -813,8 +815,8 @@
|
||||||
|
|
||||||
function createCat(position) {
|
function createCat(position) {
|
||||||
|
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx";
|
||||||
var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx";
|
var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx";
|
||||||
var animationSettings = JSON.stringify({
|
var animationSettings = JSON.stringify({
|
||||||
running: true
|
running: true
|
||||||
});
|
});
|
||||||
|
@ -850,7 +852,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFlashlight(position) {
|
function createFlashlight(position) {
|
||||||
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
|
||||||
|
|
||||||
var flashlight = Entities.addEntity({
|
var flashlight = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -864,7 +866,7 @@
|
||||||
z: 0.08
|
z: 0.08
|
||||||
},
|
},
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav",
|
||||||
gravity: {
|
gravity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -3.5,
|
y: -3.5,
|
||||||
|
@ -915,7 +917,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLights() {
|
function createLights() {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx";
|
||||||
|
|
||||||
|
|
||||||
var rotation = {
|
var rotation = {
|
||||||
|
@ -1163,8 +1165,8 @@
|
||||||
function createDice() {
|
function createDice() {
|
||||||
var diceProps = {
|
var diceProps = {
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx",
|
||||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav",
|
||||||
name: "dice",
|
name: "dice",
|
||||||
position: {
|
position: {
|
||||||
x: 541.61,
|
x: 541.61,
|
||||||
|
@ -1211,7 +1213,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGates() {
|
function createGates() {
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx';
|
||||||
|
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
|
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
|
||||||
var gate = Entities.addEntity({
|
var gate = Entities.addEntity({
|
||||||
|
@ -1252,9 +1254,9 @@
|
||||||
|
|
||||||
function createPingPongBallGun() {
|
function createPingPongBallGun() {
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx';
|
||||||
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
|
||||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
|
||||||
var position = {
|
var position = {
|
||||||
x: 548.6,
|
x: 548.6,
|
||||||
y: 495.4,
|
y: 495.4,
|
||||||
|
@ -1320,8 +1322,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWand(position) {
|
function createWand(position) {
|
||||||
var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx';
|
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
|
||||||
var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj';
|
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
|
||||||
|
|
||||||
var wand = Entities.addEntity({
|
var wand = Entities.addEntity({
|
||||||
name: 'Bubble Wand',
|
name: 'Bubble Wand',
|
||||||
|
@ -1381,7 +1383,7 @@
|
||||||
|
|
||||||
function createBasketBall(position) {
|
function createBasketBall(position) {
|
||||||
|
|
||||||
var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||||
|
|
||||||
var entity = Entities.addEntity({
|
var entity = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -1407,7 +1409,7 @@
|
||||||
y: -0.01,
|
y: -0.01,
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav",
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
resetMe: {
|
resetMe: {
|
||||||
resetMe: true
|
resetMe: true
|
||||||
|
@ -1421,7 +1423,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDoll(position) {
|
function createDoll(position) {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
|
||||||
|
|
||||||
var naturalDimensions = {
|
var naturalDimensions = {
|
||||||
x: 1.63,
|
x: 1.63,
|
||||||
|
@ -1462,7 +1464,7 @@
|
||||||
|
|
||||||
function createSprayCan(position) {
|
function createSprayCan(position) {
|
||||||
|
|
||||||
var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx";
|
||||||
|
|
||||||
var entity = Entities.addEntity({
|
var entity = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -1476,7 +1478,7 @@
|
||||||
z: 0.07
|
z: 0.07
|
||||||
},
|
},
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav",
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
restitution: 0,
|
restitution: 0,
|
||||||
gravity: {
|
gravity: {
|
||||||
|
@ -1502,7 +1504,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPottedPlant(position) {
|
function createPottedPlant(position) {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx";
|
||||||
|
|
||||||
var entity = Entities.addEntity({
|
var entity = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -1540,8 +1542,8 @@
|
||||||
|
|
||||||
|
|
||||||
function createCombinedArmChair(position) {
|
function createCombinedArmChair(position) {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx";
|
||||||
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj";
|
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj";
|
||||||
|
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
|
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
|
||||||
|
|
||||||
|
@ -1583,8 +1585,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function createBlocks(position) {
|
function createBlocks(position) {
|
||||||
var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/";
|
var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/";
|
||||||
var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav";
|
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav";
|
||||||
var NUM_BLOCKS_PER_COLOR = 4;
|
var NUM_BLOCKS_PER_COLOR = 4;
|
||||||
var i, j;
|
var i, j;
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
|
|
||||||
|
|
||||||
|
Script.include('libraries/utils.js');
|
||||||
var masterResetScript = Script.resolvePath("masterReset.js");
|
var masterResetScript = Script.resolvePath("masterReset.js");
|
||||||
var hiddenEntityScriptURL = Script.resolvePath("hiddenEntityReset.js");
|
var hiddenEntityScriptURL = Script.resolvePath("hiddenEntityReset.js");
|
||||||
|
|
313
unpublishedScripts/DomainContent/Toybox/libraries/utils.js
Normal file
313
unpublishedScripts/DomainContent/Toybox/libraries/utils.js
Normal file
|
@ -0,0 +1,313 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2015/08/29
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
vec3toStr = function(v, digits) {
|
||||||
|
if (!digits) { digits = 3; }
|
||||||
|
return "{ " + v.x.toFixed(digits) + ", " + v.y.toFixed(digits) + ", " + v.z.toFixed(digits)+ " }";
|
||||||
|
}
|
||||||
|
|
||||||
|
quatToStr = function(q, digits) {
|
||||||
|
if (!digits) { digits = 3; }
|
||||||
|
return "{ " + q.w.toFixed(digits) + ", " + q.x.toFixed(digits) + ", " +
|
||||||
|
q.y.toFixed(digits) + ", " + q.z.toFixed(digits)+ " }";
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3equal = function(v0, v1) {
|
||||||
|
return (v0.x == v1.x) && (v0.y == v1.y) && (v0.z == v1.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
colorMix = function(colorA, colorB, mix) {
|
||||||
|
var result = {};
|
||||||
|
for (var key in colorA) {
|
||||||
|
result[key] = (colorA[key] * (1 - mix)) + (colorB[key] * mix);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
scaleLine = function (start, end, scale) {
|
||||||
|
var v = Vec3.subtract(end, start);
|
||||||
|
var length = Vec3.length(v);
|
||||||
|
v = Vec3.multiply(scale, v);
|
||||||
|
return Vec3.sum(start, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
findAction = function(name) {
|
||||||
|
return Controller.findAction(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
addLine = function(origin, vector, color) {
|
||||||
|
if (!color) {
|
||||||
|
color = COLORS.WHITE
|
||||||
|
}
|
||||||
|
return Entities.addEntity(mergeObjects(LINE_PROTOTYPE, {
|
||||||
|
position: origin,
|
||||||
|
linePoints: [
|
||||||
|
ZERO_VECTOR,
|
||||||
|
vector,
|
||||||
|
],
|
||||||
|
color: color
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME fetch from a subkey of user data to support non-destructive modifications
|
||||||
|
setEntityUserData = function(id, data) {
|
||||||
|
var json = JSON.stringify(data)
|
||||||
|
Entities.editEntity(id, { userData: json });
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME do non-destructive modification of the existing user data
|
||||||
|
getEntityUserData = function(id) {
|
||||||
|
var results = null;
|
||||||
|
var properties = Entities.getEntityProperties(id, "userData");
|
||||||
|
if (properties.userData) {
|
||||||
|
try {
|
||||||
|
results = JSON.parse(properties.userData);
|
||||||
|
} catch(err) {
|
||||||
|
logDebug(err);
|
||||||
|
logDebug(properties.userData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return results ? results : {};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Non-destructively modify the user data of an entity.
|
||||||
|
setEntityCustomData = function(customKey, id, data) {
|
||||||
|
var userData = getEntityUserData(id);
|
||||||
|
if (data == null) {
|
||||||
|
delete userData[customKey];
|
||||||
|
} else {
|
||||||
|
userData[customKey] = data;
|
||||||
|
}
|
||||||
|
setEntityUserData(id, userData);
|
||||||
|
}
|
||||||
|
|
||||||
|
getEntityCustomData = function(customKey, id, defaultValue) {
|
||||||
|
var userData = getEntityUserData(id);
|
||||||
|
if (undefined != userData[customKey]) {
|
||||||
|
return userData[customKey];
|
||||||
|
} else {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mergeObjects = function(proto, custom) {
|
||||||
|
var result = {};
|
||||||
|
for (var attrname in proto) {
|
||||||
|
result[attrname] = proto[attrname];
|
||||||
|
}
|
||||||
|
for (var attrname in custom) {
|
||||||
|
result[attrname] = custom[attrname];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_WARN = 1;
|
||||||
|
|
||||||
|
logWarn = function(str) {
|
||||||
|
if (LOG_WARN) {
|
||||||
|
print(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR = 1;
|
||||||
|
|
||||||
|
logError = function(str) {
|
||||||
|
if (LOG_ERROR) {
|
||||||
|
print(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_INFO = 1;
|
||||||
|
|
||||||
|
logInfo = function(str) {
|
||||||
|
if (LOG_INFO) {
|
||||||
|
print(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_DEBUG = 0;
|
||||||
|
|
||||||
|
logDebug = function(str) {
|
||||||
|
if (LOG_DEBUG) {
|
||||||
|
print(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_TRACE = 0;
|
||||||
|
|
||||||
|
logTrace = function(str) {
|
||||||
|
if (LOG_TRACE) {
|
||||||
|
print(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Computes the penetration between a point and a sphere (centered at the origin)
|
||||||
|
// if point is inside sphere: returns true and stores the result in 'penetration'
|
||||||
|
// (the vector that would move the point outside the sphere)
|
||||||
|
// otherwise returns false
|
||||||
|
findSphereHit = function(point, sphereRadius) {
|
||||||
|
var EPSILON = 0.000001; //smallish positive number - used as margin of error for some computations
|
||||||
|
var vectorLength = Vec3.length(point);
|
||||||
|
if (vectorLength < EPSILON) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var distance = vectorLength - sphereRadius;
|
||||||
|
if (distance < 0.0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
findSpherePointHit = function(sphereCenter, sphereRadius, point) {
|
||||||
|
return findSphereHit(Vec3.subtract(point,sphereCenter), sphereRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
findSphereSphereHit = function(firstCenter, firstRadius, secondCenter, secondRadius) {
|
||||||
|
return findSpherePointHit(firstCenter, firstRadius + secondRadius, secondCenter);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Given a vec3 v, return a vec3 that is the same vector relative to the avatars
|
||||||
|
// DEFAULT eye position, rotated into the avatars reference frame.
|
||||||
|
getEyeRelativePosition = function(v) {
|
||||||
|
return Vec3.sum(MyAvatar.getDefaultEyePosition(), Vec3.multiplyQbyV(MyAvatar.orientation, v));
|
||||||
|
}
|
||||||
|
|
||||||
|
getAvatarRelativeRotation = function(q) {
|
||||||
|
return Quat.multiply(MyAvatar.orientation, q);
|
||||||
|
}
|
||||||
|
|
||||||
|
pointInExtents = function(point, minPoint, maxPoint) {
|
||||||
|
return (point.x >= minPoint.x && point.x <= maxPoint.x) &&
|
||||||
|
(point.y >= minPoint.y && point.y <= maxPoint.y) &&
|
||||||
|
(point.z >= minPoint.z && point.z <= maxPoint.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts an HSL color value to RGB. Conversion formula
|
||||||
|
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
|
||||||
|
* Assumes h, s, and l are contained in the set [0, 1] and
|
||||||
|
* returns r, g, and b in the set [0, 255].
|
||||||
|
*
|
||||||
|
* @param Number h The hue
|
||||||
|
* @param Number s The saturation
|
||||||
|
* @param Number l The lightness
|
||||||
|
* @return Array The RGB representation
|
||||||
|
*/
|
||||||
|
hslToRgb = function(hsl) {
|
||||||
|
var r, g, b;
|
||||||
|
if (hsl.s == 0) {
|
||||||
|
r = g = b = hsl.l; // achromatic
|
||||||
|
} else {
|
||||||
|
var hue2rgb = function hue2rgb(p, q, t) {
|
||||||
|
if (t < 0) t += 1;
|
||||||
|
if (t > 1) t -= 1;
|
||||||
|
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
||||||
|
if (t < 1 / 2) return q;
|
||||||
|
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
var q = hsl.l < 0.5 ? hsl.l * (1 + hsl.s) : hsl.l + hsl.s - hsl.l * hsl.s;
|
||||||
|
var p = 2 * hsl.l - q;
|
||||||
|
r = hue2rgb(p, q, hsl.h + 1 / 3);
|
||||||
|
g = hue2rgb(p, q, hsl.h);
|
||||||
|
b = hue2rgb(p, q, hsl.h - 1 / 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
red: Math.round(r * 255),
|
||||||
|
green: Math.round(g * 255),
|
||||||
|
blue: Math.round(b * 255)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
map = function(value, min1, max1, min2, max2) {
|
||||||
|
return min2 + (max2 - min2) * ((value - min1) / (max1 - min1));
|
||||||
|
}
|
||||||
|
|
||||||
|
orientationOf = function(vector) {
|
||||||
|
var Y_AXIS = {
|
||||||
|
x: 0,
|
||||||
|
y: 1,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
var X_AXIS = {
|
||||||
|
x: 1,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var theta = 0.0;
|
||||||
|
|
||||||
|
var RAD_TO_DEG = 180.0 / Math.PI;
|
||||||
|
var direction, yaw, pitch;
|
||||||
|
direction = Vec3.normalize(vector);
|
||||||
|
yaw = Quat.angleAxis(Math.atan2(direction.x, direction.z) * RAD_TO_DEG, Y_AXIS);
|
||||||
|
pitch = Quat.angleAxis(Math.asin(-direction.y) * RAD_TO_DEG, X_AXIS);
|
||||||
|
return Quat.multiply(yaw, pitch);
|
||||||
|
}
|
||||||
|
|
||||||
|
randFloat = function(low, high) {
|
||||||
|
return low + Math.random() * (high - low);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
randInt = function(low, high) {
|
||||||
|
return Math.floor(randFloat(low, high));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
randomColor = function() {
|
||||||
|
return {
|
||||||
|
red: randInt(0, 255),
|
||||||
|
green: randInt(0, 255),
|
||||||
|
blue: randInt(0, 255)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
hexToRgb = function(hex) {
|
||||||
|
var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
||||||
|
return result ? {
|
||||||
|
red: parseInt(result[1], 16),
|
||||||
|
green: parseInt(result[2], 16),
|
||||||
|
blue: parseInt(result[3], 16)
|
||||||
|
} : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
calculateHandSizeRatio = function() {
|
||||||
|
// Get the ratio of the current avatar's hand to Owen's hand
|
||||||
|
|
||||||
|
var standardCenterHandPoint = 0.11288;
|
||||||
|
var jointNames = MyAvatar.getJointNames();
|
||||||
|
//get distance from handJoint up to leftHandIndex3 as a proxy for center of hand
|
||||||
|
var wristToFingertipDistance = 0;;
|
||||||
|
for (var i = 0; i < jointNames.length; i++) {
|
||||||
|
var jointName = jointNames[i];
|
||||||
|
print(jointName)
|
||||||
|
if (jointName.indexOf("LeftHandIndex") !== -1) {
|
||||||
|
// translations are relative to parent joint, so simply add them together
|
||||||
|
// joints face down the y-axis
|
||||||
|
var translation = MyAvatar.getDefaultJointTranslation(i).y;
|
||||||
|
wristToFingertipDistance += translation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Right now units are in cm, so convert to meters
|
||||||
|
wristToFingertipDistance /= 100;
|
||||||
|
|
||||||
|
var centerHandPoint = wristToFingertipDistance/2;
|
||||||
|
|
||||||
|
// Compare against standard hand (Owen)
|
||||||
|
var handSizeRatio = centerHandPoint/standardCenterHandPoint;
|
||||||
|
return handSizeRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
clamp = function(val, min, max){
|
||||||
|
return Math.max(min, Math.min(max, val))
|
||||||
|
}
|
||||||
|
|
|
@ -17,11 +17,11 @@
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var _this;
|
var _this;
|
||||||
var utilitiesScript = Script.resolvePath("../../libraries/utils.js");
|
var utilitiesScript = Script.resolvePath("libraries/utils.js");
|
||||||
Script.include(utilitiesScript);
|
Script.include(utilitiesScript);
|
||||||
LightSwitch = function() {
|
LightSwitch = function() {
|
||||||
_this = this;
|
_this = this;
|
||||||
this.switchSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/sounds/Switches%20and%20sliders/lamp_switch_2.wav");
|
this.switchSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lamp_switch_2.wav");
|
||||||
};
|
};
|
||||||
|
|
||||||
LightSwitch.prototype = {
|
LightSwitch.prototype = {
|
||||||
|
|
|
@ -6,25 +6,21 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
|
|
||||||
//per script
|
|
||||||
|
|
||||||
|
var utilitiesScript = Script.resolvePath("libraries/utils.js");
|
||||||
/*global deleteAllToys, createAllToys, createGates, createPingPongBallGun, createFire, createPottedPlant, createCombinedArmChair, createBasketBall, createSprayCan, createDoll, createWand, createDice, createCat, deleteAllToys, createFlashlight, createBlocks, createMagballs, createLights */
|
|
||||||
var utilitiesScript = Script.resolvePath("../examples/libraries/utils.js");
|
|
||||||
Script.include(utilitiesScript);
|
Script.include(utilitiesScript);
|
||||||
|
|
||||||
var gunScriptURL = Script.resolvePath("../examples/toybox/pistol/pistol.js");
|
var gunScriptURL = Script.resolvePath("pistol/pistol.js");
|
||||||
var sprayPaintScriptURL = Script.resolvePath("../examples/toybox/spray_paint/sprayPaintCan.js");
|
var sprayPaintScriptURL = Script.resolvePath("spray_paint/sprayPaintCan.js");
|
||||||
var catScriptURL = Script.resolvePath("../examples/toybox/cat/cat.js");
|
var catScriptURL = Script.resolvePath("cat/cat.js");
|
||||||
var flashlightScriptURL = Script.resolvePath('../examples/toybox/flashlight/flashlight.js');
|
var flashlightScriptURL = Script.resolvePath('flashlight/flashlight.js');
|
||||||
var pingPongScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/pingPongGun.js');
|
var pingPongScriptURL = Script.resolvePath('ping_pong_gun/pingPongGun.js');
|
||||||
var wandScriptURL = Script.resolvePath("../examples/toybox/bubblewand/wand.js");
|
var wandScriptURL = Script.resolvePath("bubblewand/wand.js");
|
||||||
var dollScriptURL = Script.resolvePath("../examples/toybox/doll/doll.js");
|
var dollScriptURL = Script.resolvePath("doll/doll.js");
|
||||||
var lightsScriptURL = Script.resolvePath("../examples/toybox/lights/lightSwitch.js");
|
var lightsScriptURL = Script.resolvePath("lights/lightSwitch.js");
|
||||||
var bowScriptURL = Script.resolvePath("../examples/toybox/bow/bow.js");
|
var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js');
|
||||||
var raveStickEntityScriptURL = Script.resolvePath("../examples/flowArts/raveStick/raveStickEntityScript.js");
|
var bowScriptURL = Script.resolvePath('bow/bow.js');
|
||||||
var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js');
|
var raveStickEntityScriptURL = Script.resolvePath("flowArts/raveStick/raveStickEntityScript.js");
|
||||||
var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js');
|
var basketballResetterScriptURL = Script.resolvePath('basketballsResetter.js');
|
||||||
var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
||||||
|
|
||||||
|
@ -32,7 +28,6 @@ var targetsResetterScriptURL = Script.resolvePath('targetsResetter.js');
|
||||||
MasterReset = function() {
|
MasterReset = function() {
|
||||||
var resetKey = "resetMe";
|
var resetKey = "resetMe";
|
||||||
|
|
||||||
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|
||||||
|
|
||||||
var shouldDeleteOnEndScript = false;
|
var shouldDeleteOnEndScript = false;
|
||||||
|
|
||||||
|
@ -148,7 +143,7 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRaveStick(position) {
|
function createRaveStick(position) {
|
||||||
var modelURL = "http://hifi-content.s3.amazonaws.com/eric/models/raveStick.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/raveStick.fbx";
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
var rotation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
var stick = Entities.addEntity({
|
var stick = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -243,7 +238,7 @@ MasterReset = function() {
|
||||||
alphaSpread: 0.1,
|
alphaSpread: 0.1,
|
||||||
alphaStart: 0.1,
|
alphaStart: 0.1,
|
||||||
alphaFinish: 0.1,
|
alphaFinish: 0.1,
|
||||||
textures: "https://s3.amazonaws.com/hifi-public/eric/textures/particleSprites/beamParticle.png",
|
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flowArts/beamParticle.png",
|
||||||
emitterShouldTrail: false,
|
emitterShouldTrail: false,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
resetMe: {
|
resetMe: {
|
||||||
|
@ -254,7 +249,8 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGun(position) {
|
function createGun(position) {
|
||||||
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
|
||||||
|
|
||||||
|
|
||||||
var pistol = Entities.addEntity({
|
var pistol = Entities.addEntity({
|
||||||
type: 'Model',
|
type: 'Model',
|
||||||
|
@ -281,7 +277,7 @@ MasterReset = function() {
|
||||||
restitution: 0,
|
restitution: 0,
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
damping: 0.5,
|
damping: 0.5,
|
||||||
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
"wearable": {
|
"wearable": {
|
||||||
"joints": {
|
"joints": {
|
||||||
|
@ -327,9 +323,8 @@ MasterReset = function() {
|
||||||
|
|
||||||
var SCRIPT_URL = Script.resolvePath('bow.js');
|
var SCRIPT_URL = Script.resolvePath('bow.js');
|
||||||
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
|
var BOW_ROTATION = Quat.fromPitchYawRollDegrees(-103.05, -178.60, -87.27);
|
||||||
var MODEL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow-deadly.fbx";
|
var MODEL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow-deadly.fbx";
|
||||||
var COLLISION_HULL_URL = "https://hifi-public.s3.amazonaws.com/models/bow/new/bow_collision_hull.obj";
|
var COLLISION_HULL_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bow/bow_collision_hull.obj";
|
||||||
|
|
||||||
var BOW_DIMENSIONS = {
|
var BOW_DIMENSIONS = {
|
||||||
x: 0.04,
|
x: 0.04,
|
||||||
y: 1.3,
|
y: 1.3,
|
||||||
|
@ -480,7 +475,7 @@ MasterReset = function() {
|
||||||
type: "ParticleEffect",
|
type: "ParticleEffect",
|
||||||
name: "fire",
|
name: "fire",
|
||||||
animationSettings: animationSettings,
|
animationSettings: animationSettings,
|
||||||
textures: "https://hifi-public.s3.amazonaws.com/alan/Particles/Particle-Sprite-Smoke-1.png",
|
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/fire/Particle-Sprite-Smoke-1.png",
|
||||||
position: {
|
position: {
|
||||||
x: 551.45,
|
x: 551.45,
|
||||||
y: 494.82,
|
y: 494.82,
|
||||||
|
@ -544,10 +539,10 @@ MasterReset = function() {
|
||||||
var DIAMETER = 0.30;
|
var DIAMETER = 0.30;
|
||||||
var RESET_DISTANCE = 1;
|
var RESET_DISTANCE = 1;
|
||||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||||
var basketballURL = HIFI_PUBLIC_BUCKET + "models/content/basketball2.fbx";
|
var basketballURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||||
var basketballCollisionSoundURL = HIFI_PUBLIC_BUCKET + "sounds/basketball/basketball.wav";
|
var basketballCollisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav";
|
||||||
var rackURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/basketball_rack.fbx";
|
var rackURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball_rack.fbx";
|
||||||
var rackCollisionHullURL = HIFI_PUBLIC_BUCKET + "models/basketball_hoop/rack_collision_hull.obj";
|
var rackCollisionHullURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/rack_collision_hull.obj";
|
||||||
|
|
||||||
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
var rackRotation = Quat.fromPitchYawRollDegrees(0, -90, 0);
|
||||||
|
|
||||||
|
@ -624,7 +619,7 @@ MasterReset = function() {
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
collisionSoundURL: 'http://hifi-public.s3.amazonaws.com/sounds/basketball/basketball.wav',
|
collisionSoundURL: 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav',
|
||||||
collisionless: false,
|
collisionless: false,
|
||||||
modelURL: basketballURL,
|
modelURL: basketballURL,
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
|
@ -721,8 +716,8 @@ MasterReset = function() {
|
||||||
function createTargets() {
|
function createTargets() {
|
||||||
|
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||||
|
|
||||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||||
var RESET_DISTANCE = 0.5;
|
var RESET_DISTANCE = 0.5;
|
||||||
|
@ -801,8 +796,8 @@ MasterReset = function() {
|
||||||
|
|
||||||
function createCat(position) {
|
function createCat(position) {
|
||||||
|
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/Dark_Cat.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/Dark_Cat.fbx";
|
||||||
var animationURL = "http://hifi-public.s3.amazonaws.com/ryan/sleeping.fbx";
|
var animationURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/cat/sleeping.fbx";
|
||||||
var animationSettings = JSON.stringify({
|
var animationSettings = JSON.stringify({
|
||||||
running: true
|
running: true
|
||||||
});
|
});
|
||||||
|
@ -838,7 +833,7 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFlashlight(position) {
|
function createFlashlight(position) {
|
||||||
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight.fbx";
|
||||||
|
|
||||||
var flashlight = Entities.addEntity({
|
var flashlight = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -852,7 +847,7 @@ MasterReset = function() {
|
||||||
z: 0.08
|
z: 0.08
|
||||||
},
|
},
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/flashlight_drop.L.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/flashlight/flashlight_drop.L.wav",
|
||||||
gravity: {
|
gravity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -3.5,
|
y: -3.5,
|
||||||
|
@ -903,8 +898,7 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLights() {
|
function createLights() {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/ryan/lightswitch.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/lights/lightswitch.fbx";
|
||||||
|
|
||||||
|
|
||||||
var rotation = {
|
var rotation = {
|
||||||
w: 0.63280689716339111,
|
w: 0.63280689716339111,
|
||||||
|
@ -1151,8 +1145,8 @@ MasterReset = function() {
|
||||||
function createDice() {
|
function createDice() {
|
||||||
var diceProps = {
|
var diceProps = {
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: "http://s3.amazonaws.com/hifi-public/models/props/Dice/goldDie.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/goldDie.fbx",
|
||||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/dice/diceCollide.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/dice/diceCollide.wav",
|
||||||
name: "dice",
|
name: "dice",
|
||||||
position: {
|
position: {
|
||||||
x: 541.61,
|
x: 541.61,
|
||||||
|
@ -1199,8 +1193,7 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createGates() {
|
function createGates() {
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/ryan/fence.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/gates/fence.fbx';
|
||||||
|
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
|
var rotation = Quat.fromPitchYawRollDegrees(0, -16, 0);
|
||||||
var gate = Entities.addEntity({
|
var gate = Entities.addEntity({
|
||||||
name: 'Front Door Fence',
|
name: 'Front Door Fence',
|
||||||
|
@ -1239,10 +1232,9 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPingPongBallGun() {
|
function createPingPongBallGun() {
|
||||||
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx';
|
||||||
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
|
||||||
|
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
|
||||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
|
||||||
var position = {
|
var position = {
|
||||||
x: 548.6,
|
x: 548.6,
|
||||||
y: 495.4,
|
y: 495.4,
|
||||||
|
@ -1308,8 +1300,8 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createWand(position) {
|
function createWand(position) {
|
||||||
var WAND_MODEL = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand.fbx';
|
var WAND_MODEL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand.fbx';
|
||||||
var WAND_COLLISION_SHAPE = 'http://hifi-content.s3.amazonaws.com/james/bubblewand/wand_collision_hull.obj';
|
var WAND_COLLISION_SHAPE = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/bubblewand/wand_collision_hull.obj';
|
||||||
|
|
||||||
var wand = Entities.addEntity({
|
var wand = Entities.addEntity({
|
||||||
name: 'Bubble Wand',
|
name: 'Bubble Wand',
|
||||||
|
@ -1369,7 +1361,7 @@ MasterReset = function() {
|
||||||
|
|
||||||
function createBasketBall(position) {
|
function createBasketBall(position) {
|
||||||
|
|
||||||
var modelURL = "http://s3.amazonaws.com/hifi-public/models/content/basketball2.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball2.fbx";
|
||||||
|
|
||||||
var entity = Entities.addEntity({
|
var entity = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -1395,7 +1387,7 @@ MasterReset = function() {
|
||||||
y: -0.01,
|
y: -0.01,
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
collisionSoundURL: "http://s3.amazonaws.com/hifi-public/sounds/basketball/basketball.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/basketball/basketball.wav",
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
resetMe: {
|
resetMe: {
|
||||||
resetMe: true
|
resetMe: true
|
||||||
|
@ -1409,7 +1401,7 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDoll(position) {
|
function createDoll(position) {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/Bboys/bboy2/bboy2.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/doll/bboy2.fbx";
|
||||||
|
|
||||||
var naturalDimensions = {
|
var naturalDimensions = {
|
||||||
x: 1.63,
|
x: 1.63,
|
||||||
|
@ -1450,7 +1442,8 @@ MasterReset = function() {
|
||||||
|
|
||||||
function createSprayCan(position) {
|
function createSprayCan(position) {
|
||||||
|
|
||||||
var modelURL = "https://hifi-public.s3.amazonaws.com/eric/models/paintcan.fbx";
|
|
||||||
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/paintcan.fbx";
|
||||||
|
|
||||||
var entity = Entities.addEntity({
|
var entity = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -1464,7 +1457,7 @@ MasterReset = function() {
|
||||||
z: 0.07
|
z: 0.07
|
||||||
},
|
},
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
collisionSoundURL: "http://hifi-public.s3.amazonaws.com/sounds/SpryPntCnDrp1.L.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/SpryPntCnDrp1.L.wav",
|
||||||
shapeType: 'box',
|
shapeType: 'box',
|
||||||
gravity: {
|
gravity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
|
@ -1490,7 +1483,7 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createPottedPlant(position) {
|
function createPottedPlant(position) {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/potted_plant/potted_plant.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/potted_plant/potted_plant.fbx";
|
||||||
|
|
||||||
var entity = Entities.addEntity({
|
var entity = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
|
@ -1528,8 +1521,8 @@ MasterReset = function() {
|
||||||
|
|
||||||
|
|
||||||
function createCombinedArmChair(position) {
|
function createCombinedArmChair(position) {
|
||||||
var modelURL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/combined_chair.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/combined_chair.fbx";
|
||||||
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-public.s3.amazonaws.com/models/red_arm_chair/red_arm_chair_collision_hull.obj";
|
var RED_ARM_CHAIR_COLLISION_HULL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/armchair/red_arm_chair_collision_hull.obj";
|
||||||
|
|
||||||
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
|
var rotation = Quat.fromPitchYawRollDegrees(0, -143, 0);
|
||||||
|
|
||||||
|
@ -1571,8 +1564,8 @@ MasterReset = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function createBlocks(position) {
|
function createBlocks(position) {
|
||||||
var baseURL = HIFI_PUBLIC_BUCKET + "models/content/planky/";
|
var baseURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/";
|
||||||
var collisionSoundURL = "https://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/ToyWoodBlock.L.wav";
|
var collisionSoundURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/planky/ToyWoodBlock.L.wav";
|
||||||
var NUM_BLOCKS_PER_COLOR = 4;
|
var NUM_BLOCKS_PER_COLOR = 4;
|
||||||
var i, j;
|
var i, j;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
var PLAYLIST_URL = "https://spreadsheets.google.com/feeds/cells/1x-ceGPGHldkHadARABFWfujLPTOWzXJPhrf2bTwg2cQ/od6/public/basic?alt=json";
|
var PLAYLIST_URL = "https://spreadsheets.google.com/feeds/cells/1x-ceGPGHldkHadARABFWfujLPTOWzXJPhrf2bTwg2cQ/od6/public/basic?alt=json";
|
||||||
var SONG_VOLUME = 0.1;
|
var SONG_VOLUME = 0.1;
|
||||||
var HEADPHONES_ATTACHMENT = {
|
var HEADPHONES_ATTACHMENT = {
|
||||||
modelURL: "https://s3.amazonaws.com/hifi-public/brad/musicplayer/headphones2-v2.fbx",
|
modelURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/musicPlayer/headphones2-v2.fbx",
|
||||||
jointName: "Head",
|
jointName: "Head",
|
||||||
translation: {"x": 0, "y": 0.19, "z": 0.06},
|
translation: {"x": 0, "y": 0.19, "z": 0.06},
|
||||||
rotation: {"x":0,"y":0.7071067690849304,"z":0.7071067690849304,"w":0},
|
rotation: {"x":0,"y":0.7071067690849304,"z":0.7071067690849304,"w":0},
|
||||||
|
|
|
@ -13,9 +13,9 @@ Script.include("../../libraries/utils.js");
|
||||||
|
|
||||||
var scriptURL = Script.resolvePath('pingPongGun.js');
|
var scriptURL = Script.resolvePath('pingPongGun.js');
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.fbx'
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.fbx'
|
||||||
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Pingpong-Gun-New.obj';
|
||||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
var COLLISION_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/plastic_impact.L.wav';
|
||||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0.5,
|
y: 0.5,
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
//
|
//
|
||||||
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("utils.js");
|
||||||
var scriptURL = Script.resolvePath('wallTarget.js');
|
var scriptURL = Script.resolvePath('wallTarget.js');
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||||
var RESET_DISTANCE = 0.5;
|
var RESET_DISTANCE = 0.5;
|
||||||
|
|
||||||
|
|
|
@ -11,10 +11,10 @@
|
||||||
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camera, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt */
|
||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("utils.js");
|
||||||
|
|
||||||
var SHOOTING_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/ping_pong_gun/pong_sound.wav';
|
var SHOOTING_SOUND_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/pong_sound.wav';
|
||||||
var PING_PONG_BALL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/ping_pong_ball.fbx';
|
var PING_PONG_BALL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/ping_pong_ball.fbx';
|
||||||
|
|
||||||
function PingPongGun() {
|
function PingPongGun() {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
hasBecomeActive: false,
|
hasBecomeActive: false,
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
var SOUND_URL = "http://hifi-public.s3.amazonaws.com/sounds/Clay_Pigeon_02.L.wav";
|
var SOUND_URL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/Clay_Pigeon_02.L.wav";
|
||||||
this.hitSound = SoundCache.getSound(SOUND_URL);
|
this.hitSound = SoundCache.getSound(SOUND_URL);
|
||||||
},
|
},
|
||||||
collisionWithEntity: function(me, otherEntity) {
|
collisionWithEntity: function(me, otherEntity) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation())));
|
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(1.5, Quat.getFront(Camera.getOrientation())));
|
||||||
var scriptURL = Script.resolvePath('pistol.js');
|
var scriptURL = Script.resolvePath('pistol.js');
|
||||||
var modelURL = "https://s3.amazonaws.com/hifi-public/eric/models/gun.fbx";
|
var modelURL = "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/gun.fbx";
|
||||||
|
|
||||||
|
|
||||||
var pistol = Entities.addEntity({
|
var pistol = Entities.addEntity({
|
||||||
|
@ -27,7 +27,7 @@ var pistol = Entities.addEntity({
|
||||||
},
|
},
|
||||||
restitution: 0,
|
restitution: 0,
|
||||||
damping:0.5,
|
damping:0.5,
|
||||||
collisionSoundURL: "http://hifi-content.s3.amazonaws.com/james/pistol/sounds/drop.wav",
|
collisionSoundURL: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/drop.wav",
|
||||||
userData: JSON.stringify({
|
userData: JSON.stringify({
|
||||||
grabbableKey: {
|
grabbableKey: {
|
||||||
invertSolidWhileHeld: true
|
invertSolidWhileHeld: true
|
||||||
|
|
|
@ -11,8 +11,7 @@
|
||||||
|
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
Script.include("../../libraries/constants.js");
|
|
||||||
|
|
||||||
var _this;
|
var _this;
|
||||||
var DISABLE_LASER_THRESHOLD = 0.2;
|
var DISABLE_LASER_THRESHOLD = 0.2;
|
||||||
|
@ -28,8 +27,8 @@
|
||||||
this.forceMultiplier = 1;
|
this.forceMultiplier = 1;
|
||||||
this.laserLength = 100;
|
this.laserLength = 100;
|
||||||
|
|
||||||
this.fireSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/GUN-SHOT2.raw");
|
this.fireSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/GUN-SHOT2.raw");
|
||||||
this.ricochetSound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/Guns/Ricochet.L.wav");
|
this.ricochetSound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/Ricochet.L.wav");
|
||||||
this.playRichochetSoundChance = 0.1;
|
this.playRichochetSoundChance = 0.1;
|
||||||
this.fireVolume = 0.2;
|
this.fireVolume = 0.2;
|
||||||
this.bulletForce = 10;
|
this.bulletForce = 10;
|
||||||
|
@ -217,7 +216,7 @@
|
||||||
"alphaStart": 0,
|
"alphaStart": 0,
|
||||||
"alphaFinish": 0,
|
"alphaFinish": 0,
|
||||||
"additiveBlending": true,
|
"additiveBlending": true,
|
||||||
"textures": "http://ericrius1.github.io/PartiArt/assets/star.png"
|
"textures": "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/pistol/star.png"
|
||||||
});
|
});
|
||||||
|
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
|
@ -343,8 +342,8 @@
|
||||||
preload: function(entityID) {
|
preload: function(entityID) {
|
||||||
this.entityID = entityID;
|
this.entityID = entityID;
|
||||||
this.laser = Overlays.addOverlay("line3d", {
|
this.laser = Overlays.addOverlay("line3d", {
|
||||||
start: ZERO_VECTOR,
|
start: { x: 0, y: 0, z: 0 },
|
||||||
end: ZERO_VECTOR,
|
end: { x: 0, y: 0, z: 0 },
|
||||||
color: COLORS.RED,
|
color: COLORS.RED,
|
||||||
alpha: 1,
|
alpha: 1,
|
||||||
visible: true,
|
visible: true,
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
// Script.include("../libraries/utils.js");
|
// Script.include("../libraries/utils.js");
|
||||||
//Need absolute path for now, for testing before PR merge and s3 cloning. Will change post-merge
|
//Need absolute path for now, for testing before PR merge and s3 cloning. Will change post-merge
|
||||||
|
|
||||||
Script.include("../../libraries/utils.js");
|
Script.include("libraries/utils.js");
|
||||||
|
|
||||||
this.spraySound = SoundCache.getSound("https://s3.amazonaws.com/hifi-public/sounds/sprayPaintSound.wav");
|
this.spraySound = SoundCache.getSound("http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/spray_paint.wav");
|
||||||
|
|
||||||
var TIP_OFFSET_Z = 0.02;
|
var TIP_OFFSET_Z = 0.02;
|
||||||
var TIP_OFFSET_Y = 0.08;
|
var TIP_OFFSET_Y = 0.08;
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
name: "streamEffect",
|
name: "streamEffect",
|
||||||
isEmitting: true,
|
isEmitting: true,
|
||||||
position: position,
|
position: position,
|
||||||
textures: "https://raw.githubusercontent.com/ericrius1/SantasLair/santa/assets/smokeparticle.png",
|
textures: "http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/spray_paint/smokeparticle.png",
|
||||||
emitSpeed: 3,
|
emitSpeed: 3,
|
||||||
speedSpread: 0.02,
|
speedSpread: 0.02,
|
||||||
emitAcceleration: ZERO_VEC,
|
emitAcceleration: ZERO_VEC,
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var targetsScriptURL = Script.resolvePath('../examples/toybox/ping_pong_gun/wallTarget.js');
|
var targetsScriptURL = Script.resolvePath('ping_pong_gun/wallTarget.js');
|
||||||
|
|
||||||
var _this;
|
var _this;
|
||||||
Resetter = function() {
|
Resetter = function() {
|
||||||
|
@ -44,8 +44,8 @@
|
||||||
|
|
||||||
createTargets: function() {
|
createTargets: function() {
|
||||||
|
|
||||||
var MODEL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target.fbx';
|
var MODEL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target.fbx';
|
||||||
var COLLISION_HULL_URL = 'http://hifi-public.s3.amazonaws.com/models/ping_pong_gun/target_collision_hull.obj';
|
var COLLISION_HULL_URL = 'http://hifi-production.s3.amazonaws.com/DomainContent/Toybox/ping_pong_gun/target_collision_hull.obj';
|
||||||
|
|
||||||
var MINIMUM_MOVE_LENGTH = 0.05;
|
var MINIMUM_MOVE_LENGTH = 0.05;
|
||||||
var RESET_DISTANCE = 0.5;
|
var RESET_DISTANCE = 0.5;
|
Loading…
Reference in a new issue