More files
This commit is contained in:
parent
f4e57f71b2
commit
e5a0e04eb1
667 changed files with 9631 additions and 0 deletions
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -19,3 +19,5 @@
|
||||||
*.TGA filter=lfs diff=lfs merge=lfs -text
|
*.TGA filter=lfs diff=lfs merge=lfs -text
|
||||||
*.tif filter=lfs diff=lfs merge=lfs -text
|
*.tif filter=lfs diff=lfs merge=lfs -text
|
||||||
*.obj filter=lfs diff=lfs merge=lfs -text
|
*.obj filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.FBX filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
205
hifi-content/alessandro/dev/JS/Cart/shopCartEntityScript.js
Normal file
205
hifi-content/alessandro/dev/JS/Cart/shopCartEntityScript.js
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
//cart
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/libraries/utils.js");
|
||||||
|
COMFORT_ARM_LENGTH = 0.5;
|
||||||
|
|
||||||
|
var _this;
|
||||||
|
var cartIsMine = false;
|
||||||
|
var originalY = 0;
|
||||||
|
var itemsID = [];
|
||||||
|
var relativeItemsPosition = [];
|
||||||
|
var scaleFactor = 0.7; //The scale factor will dipend on the number of items in the cart. We would resize even the items already present.
|
||||||
|
var cartTargetPosition;
|
||||||
|
var cartTargetRotation;
|
||||||
|
|
||||||
|
// this is the "constructor" for the entity as a JS object we don't do much here, but we do want to remember
|
||||||
|
// our this object, so we can access it in cases where we're called without a this (like in the case of various global signals)
|
||||||
|
ShopCart = function() {
|
||||||
|
_this = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
function update(deltaTime) {
|
||||||
|
_this.followAvatar();
|
||||||
|
_this.carryItems();
|
||||||
|
|
||||||
|
if (Controller.getValue(Controller.Standard.RightPrimaryThumb)) {
|
||||||
|
_this.resetCart();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ShopCart.prototype = {
|
||||||
|
|
||||||
|
// preload() will be called when the entity has become visible (or known) to the interface
|
||||||
|
// it gives us a chance to set our local JavaScript object up. In this case it means:
|
||||||
|
// * remembering our entityID, so we can access it in cases where we're called without an entityID
|
||||||
|
// * connecting to the update signal so we can check our grabbed state
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
//get the owner ID from user data and compare to the mine
|
||||||
|
//the update will be connected just for the owner
|
||||||
|
var ownerObj = getEntityCustomData('ownerKey', this.entityID, null);
|
||||||
|
if (ownerObj.ownerID === MyAvatar.sessionUUID) {
|
||||||
|
cartIsMine = true;
|
||||||
|
cartTargetPosition = Entities.getEntityProperties(_this.entityID).position; //useful if the entity script is assigned manually
|
||||||
|
Script.update.connect(update);
|
||||||
|
print("PRELOAD USER DATA: " + Entities.getEntityProperties(_this.entityID).userData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
carryItems: function() {
|
||||||
|
for (var i=0; i < itemsID.length; i++) {
|
||||||
|
var newPosition = Vec3.sum(Entities.getEntityProperties(_this.entityID).position, relativeItemsPosition[i]);
|
||||||
|
Entities.editEntity(itemsID[i], { position: newPosition });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
followAvatar: function() {
|
||||||
|
if (Vec3.length(MyAvatar.getVelocity()) > 0.1) {
|
||||||
|
//update cart target position and orientation
|
||||||
|
var radius = (Entities.getEntityProperties(_this.entityID).dimensions.x) / 2 + COMFORT_ARM_LENGTH;
|
||||||
|
//Vec3.length(Entities.getEntityProperties(_this.entityID).dimensions) / 2.0; //old radius
|
||||||
|
var properY = MyAvatar.position.y + ((MyAvatar.getHeadPosition().y - MyAvatar.position.y) / 2);
|
||||||
|
var targetPositionPrecomputing = {x: MyAvatar.position.x, y: properY, z: MyAvatar.position.z};
|
||||||
|
cartTargetPosition = Vec3.sum(targetPositionPrecomputing, Vec3.multiply(Quat.getRight(MyAvatar.orientation), radius));
|
||||||
|
}
|
||||||
|
|
||||||
|
var cartPosition = Entities.getEntityProperties(_this.entityID).position;
|
||||||
|
var positionDifference = Vec3.subtract(cartTargetPosition, cartPosition);
|
||||||
|
if (Vec3.length(positionDifference) > 0.01) {
|
||||||
|
//give to the cart the proper velocity
|
||||||
|
//print("fixing position - difference is: " + Vec3.length(positionDifference));
|
||||||
|
Entities.editEntity(_this.entityID, { velocity: positionDifference });
|
||||||
|
Entities.editEntity(_this.entityID, { ignoreForCollisions: true });
|
||||||
|
} else if (Vec3.length(positionDifference) > 0) {
|
||||||
|
//set the position
|
||||||
|
//print("setting position - difference is: " + Vec3.length(positionDifference));
|
||||||
|
Entities.editEntity(_this.entityID, { position: cartTargetPosition });
|
||||||
|
positionDifference = Vec3.subtract(cartTargetPosition, cartPosition);
|
||||||
|
Entities.editEntity(_this.entityID, { velocity: positionDifference });
|
||||||
|
Entities.editEntity(_this.entityID, { ignoreForCollisions: false });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
resetCart: function (entityID) {
|
||||||
|
|
||||||
|
print("RESET CART - USER DATA: " + Entities.getEntityProperties(_this.entityID).userData);
|
||||||
|
|
||||||
|
print("itemsQuantity before: " + itemsID.length);
|
||||||
|
if (itemsID.length != 0) {
|
||||||
|
// Delete all the items (entities)
|
||||||
|
for (var i=0; i < itemsID.length; i++) {
|
||||||
|
Entities.deleteEntity(itemsID[i]);
|
||||||
|
}
|
||||||
|
print("Entities removed");
|
||||||
|
|
||||||
|
// Delete the userData fields for the items
|
||||||
|
// set userData in a destructive way
|
||||||
|
Entities.editEntity(this.entityID, { userData: ""}); // in which format do we write the owner of the cart at the beginning?
|
||||||
|
|
||||||
|
setEntityCustomData('ownerKey', this.entityID, {
|
||||||
|
ownerID: MyAvatar.sessionUUID
|
||||||
|
});
|
||||||
|
|
||||||
|
setEntityCustomData('grabbableKey', this.entityID, {
|
||||||
|
grabbable: false
|
||||||
|
});
|
||||||
|
|
||||||
|
print("userData clean");
|
||||||
|
itemsID = [];
|
||||||
|
print("itemsQuantity after: " + itemsID.length);
|
||||||
|
|
||||||
|
// Clean the relativePostion array
|
||||||
|
relativeItemsPosition = [];
|
||||||
|
print("relative position array " + relativeItemsPosition.length);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
refreshCartContent: function (entityID, dataArray) {
|
||||||
|
var data = JSON.parse(dataArray[0]);
|
||||||
|
var itemOwnerObj = getEntityCustomData('ownerKey', data.id, null);
|
||||||
|
|
||||||
|
if (((itemOwnerObj == null) ? itemOwnerObj : itemOwnerObj.ownerID) === MyAvatar.sessionUUID) {
|
||||||
|
print("The owner of the item is you");
|
||||||
|
} else {
|
||||||
|
print("NOT YOUR ITEM, NOT YOUR CART!");
|
||||||
|
}
|
||||||
|
|
||||||
|
print("item ID: " + data.id);
|
||||||
|
|
||||||
|
for (var i=0; i < itemsID.length; i++) {
|
||||||
|
if(itemsID[i] == data.id) {
|
||||||
|
itemsID.splice(i, 1);
|
||||||
|
relativeItemsPosition.splice(i,1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print("Number of items in cart: " + itemsID.length);
|
||||||
|
itemsID.forEach( function(p) { print(p) });
|
||||||
|
},
|
||||||
|
|
||||||
|
doSomething: function (entityID, dataArray) {
|
||||||
|
var data = JSON.parse(dataArray[0]);
|
||||||
|
var itemOwnerObj = getEntityCustomData('ownerKey', data.id, null);
|
||||||
|
print("------- The owner of the item is: " + ((itemOwnerObj == null) ? itemOwnerObj : itemOwnerObj.ownerID));
|
||||||
|
print("item ID: " + data.id);
|
||||||
|
|
||||||
|
var cartOwnerObj = getEntityCustomData('ownerKey', this.entityID, null);
|
||||||
|
print("------- The owner of the cart is: " + ((cartOwnerObj == null) ? cartOwnerObj : cartOwnerObj.ownerID));
|
||||||
|
print("cart ID: " + this.entityID);
|
||||||
|
|
||||||
|
if (cartOwnerObj == null) {
|
||||||
|
print("The cart doesn't have a owner.");
|
||||||
|
Entities.deleteEntity(data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemOwnerObj.ownerID === cartOwnerObj.ownerID) {
|
||||||
|
// if itemsQuantity == fullCart resize all the items present in the cart and change the scaleFactor for this and next insert
|
||||||
|
|
||||||
|
print("Going to put item in the cart!");
|
||||||
|
var itemsQuantity = itemsID.length;
|
||||||
|
|
||||||
|
itemsID[itemsQuantity] = data.id;
|
||||||
|
|
||||||
|
var oldDimension = Entities.getEntityProperties(data.id).dimensions;
|
||||||
|
Entities.editEntity(data.id, { dimensions: Vec3.multiply(oldDimension, scaleFactor) });
|
||||||
|
print("Item resized!");
|
||||||
|
|
||||||
|
Entities.editEntity(data.id, { velocity: MyAvatar.getVelocity() }); // MyAvatar.getVelocity() should be zero at this time
|
||||||
|
var oldPosition = Entities.getEntityProperties(data.id).position;
|
||||||
|
var cartPosition = Entities.getEntityProperties(this.entityID).position;
|
||||||
|
relativeItemsPosition[itemsQuantity] = Vec3.subtract(oldPosition, cartPosition);
|
||||||
|
|
||||||
|
|
||||||
|
// debug prints
|
||||||
|
//Vec3.print("Relative position saved: ", relativeItemsPosition[(itemsQuantity === 1) ? itemsQuantity : itemsQuantity.num]);
|
||||||
|
itemsQuantity = itemsID.length;
|
||||||
|
print("Item " + itemsQuantity + itemsID[itemsQuantity-1] + " inserted! New quantity: " + itemsQuantity);
|
||||||
|
relativeItemsPosition.forEach( function(p) { Vec3.print("", p) });
|
||||||
|
|
||||||
|
setEntityCustomData('statusKey', data.id, {
|
||||||
|
status: "inCart"
|
||||||
|
});
|
||||||
|
|
||||||
|
print("Set status!");
|
||||||
|
}else {
|
||||||
|
print("Not your cart!");
|
||||||
|
Entities.deleteEntity(data.id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
unload: function (entityID) {
|
||||||
|
print("UNLOAD CART");
|
||||||
|
if(cartIsMine){
|
||||||
|
Script.update.disconnect(update);
|
||||||
|
_this.resetCart(); //useful if the script is reloaded manually
|
||||||
|
//Entities.deleteEntity(_this.entityID); /commented to allow manual reload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// entity scripts always need to return a newly constructed object of our type
|
||||||
|
return new ShopCart();
|
||||||
|
})
|
|
@ -0,0 +1,90 @@
|
||||||
|
//cartzone
|
||||||
|
|
||||||
|
//
|
||||||
|
// recordingEntityScript.js
|
||||||
|
// examples/entityScripts
|
||||||
|
//
|
||||||
|
// Created by Alessandro Signa on 11/12/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
|
||||||
|
// All the avatars in the area when the master presses the button will start/stop recording.
|
||||||
|
//
|
||||||
|
|
||||||
|
// 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 CART_MASTER_NAME = "ShopCartZero";
|
||||||
|
var SCRIPT_URL = "https://hifi-content.s3.amazonaws.com/alessandro/dev/JS/Cart/shopCartEntityScript.js";
|
||||||
|
var _this;
|
||||||
|
var isOwningACart = false;
|
||||||
|
var cartMasterID = null;
|
||||||
|
var myCartID = null;
|
||||||
|
|
||||||
|
|
||||||
|
function SpawnCartZone() {
|
||||||
|
_this = this;
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SpawnCartZone.prototype = {
|
||||||
|
|
||||||
|
preload: function (entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
var ids = Entities.findEntities(Entities.getEntityProperties(this.entityID).position, 50);
|
||||||
|
ids.forEach(function(id) {
|
||||||
|
var properties = Entities.getEntityProperties(id);
|
||||||
|
if (properties.name == CART_MASTER_NAME) {
|
||||||
|
cartMasterID = id;
|
||||||
|
print("Cart master found");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
enterEntity: function (entityID) {
|
||||||
|
print("entering in the spawn cart area");
|
||||||
|
if (isOwningACart == false) {
|
||||||
|
var entityProperties = Entities.getEntityProperties(cartMasterID);
|
||||||
|
|
||||||
|
myCartID = Entities.addEntity({
|
||||||
|
type: entityProperties.type,
|
||||||
|
name: "Shopping cart",
|
||||||
|
ignoreForCollisions: false,
|
||||||
|
collisionsWillMove: false,
|
||||||
|
dimensions: entityProperties.dimensions,
|
||||||
|
modelURL: entityProperties.modelURL,
|
||||||
|
shapeType: entityProperties.shapeType,
|
||||||
|
originalTextures: entityProperties.originalTextures,
|
||||||
|
script: SCRIPT_URL,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
ownerKey: {
|
||||||
|
ownerID: MyAvatar.sessionUUID
|
||||||
|
},
|
||||||
|
grabbableKey: {
|
||||||
|
grabbable: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
isOwningACart = true;
|
||||||
|
} else {
|
||||||
|
Entities.callEntityMethod(myCartID, "resetCart");
|
||||||
|
Entities.deleteEntity (myCartID);
|
||||||
|
isOwningACart = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
leaveEntity: function (entityID) {
|
||||||
|
print("leaving the spawn cart area");
|
||||||
|
},
|
||||||
|
|
||||||
|
unload: function (entityID) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SpawnCartZone();
|
||||||
|
});
|
|
@ -0,0 +1,30 @@
|
||||||
|
//cart ball zero
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
BALL_ANGULAR_VELOCITY = {x:0, y:5, z:0}
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
|
||||||
|
// this is the "constructor" for the entity as a JS object we don't do much here, but we do want to remember
|
||||||
|
// our this object, so we can access it in cases where we're called without a this (like in the case of various global signals)
|
||||||
|
ShopCartZero = function() {
|
||||||
|
_this = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
ShopCartZero.prototype = {
|
||||||
|
|
||||||
|
// preload() will be called when the entity has become visible (or known) to the interface
|
||||||
|
// it gives us a chance to set our local JavaScript object up. In this case it means:
|
||||||
|
// * remembering our entityID, so we can access it in cases where we're called without an entityID
|
||||||
|
// * connecting to the update signal so we can check our grabbed state
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
Entities.editEntity(_this.entityID, { angularVelocity: BALL_ANGULAR_VELOCITY });
|
||||||
|
Entities.editEntity(_this.entityID, { angularDamping: 0 });
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// entity scripts always need to return a newly constructed object of our type
|
||||||
|
return new ShopCartZero();
|
||||||
|
})
|
45
hifi-content/alessandro/dev/JS/Cash/shopCashEntityScript.js
Normal file
45
hifi-content/alessandro/dev/JS/Cash/shopCashEntityScript.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
//cashzone
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var _this;
|
||||||
|
|
||||||
|
var AGENT_PLAYBACK_CHANNEL = "playbackChannel";
|
||||||
|
var isPlaying = false;
|
||||||
|
|
||||||
|
|
||||||
|
function CashZone() {
|
||||||
|
_this = this;
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
CashZone.prototype = {
|
||||||
|
|
||||||
|
preload: function (entityID) {
|
||||||
|
},
|
||||||
|
|
||||||
|
enterEntity: function (entityID) {
|
||||||
|
print("entering in the cash area");
|
||||||
|
if(!isPlaying) {
|
||||||
|
Messages.sendMessage(AGENT_PLAYBACK_CHANNEL, "Play");
|
||||||
|
print("Play sent.");
|
||||||
|
isPlaying = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
leaveEntity: function (entityID) {
|
||||||
|
print("leaving cash area");
|
||||||
|
if(isPlaying) {
|
||||||
|
Messages.sendMessage(AGENT_PLAYBACK_CHANNEL, "Pause");
|
||||||
|
print("Pause sent.");
|
||||||
|
isPlaying = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
unload: function (entityID) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new CashZone();
|
||||||
|
});
|
87
hifi-content/alessandro/dev/JS/Cash/shopCashierAC.js
Normal file
87
hifi-content/alessandro/dev/JS/Cash/shopCashierAC.js
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
|
||||||
|
// Set the following variables to the values needed
|
||||||
|
var clip_url = "atp:4417bd30c34b970db276ee500a16ff3677ff766a45df0cc0549f3281517190b7.hfr"; // This url is working in VRshop
|
||||||
|
// atp:4147173bdb79d0f48d8fdec2ad3a27926177e8f67e8c1078a841e389145a52d3.hfr
|
||||||
|
var PLAYBACK_CHANNEL = "playbackChannel";
|
||||||
|
var playFromCurrentLocation = true;
|
||||||
|
var useDisplayName = true;
|
||||||
|
var useAttachments = true;
|
||||||
|
var useAvatarModel = true;
|
||||||
|
|
||||||
|
// Set position/orientation/scale here if playFromCurrentLocation is true
|
||||||
|
Avatar.position = { x:0, y: 0, z: 0 };
|
||||||
|
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
|
Avatar.scale = 1.0;
|
||||||
|
|
||||||
|
var totalTime = 0;
|
||||||
|
var subscribed = false;
|
||||||
|
var WAIT_FOR_AUDIO_MIXER = 1;
|
||||||
|
|
||||||
|
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
||||||
|
var PLAY = "Play";
|
||||||
|
var PAUSE = "Pause";
|
||||||
|
|
||||||
|
Recording.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||||
|
Recording.setPlayerUseDisplayName(useDisplayName);
|
||||||
|
Recording.setPlayerUseAttachments(useAttachments);
|
||||||
|
Recording.setPlayerUseHeadModel(false);
|
||||||
|
Recording.setPlayerUseSkeletonModel(useAvatarModel);
|
||||||
|
|
||||||
|
function getAction(channel, message, senderID) {
|
||||||
|
if(subscribed) {
|
||||||
|
print("I'm the agent and I received this: " + message);
|
||||||
|
|
||||||
|
switch(message) {
|
||||||
|
case PLAY:
|
||||||
|
print("Play");
|
||||||
|
if (!Agent.isAvatar) {
|
||||||
|
Agent.isAvatar = true;
|
||||||
|
}
|
||||||
|
if (!Recording.isPlaying()) {
|
||||||
|
Recording.startPlaying();
|
||||||
|
}
|
||||||
|
Recording.setPlayerLoop(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PAUSE:
|
||||||
|
print("Pause");
|
||||||
|
if (Recording.isPlaying()) {
|
||||||
|
Recording.stopPlaying();
|
||||||
|
}
|
||||||
|
//Agent.isAvatar = false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
print("Unknown action: " + action);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Recording.isPlaying()) {
|
||||||
|
Recording.play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function update(deltaTime) {
|
||||||
|
|
||||||
|
totalTime += deltaTime;
|
||||||
|
|
||||||
|
if (totalTime > WAIT_FOR_AUDIO_MIXER) {
|
||||||
|
if (!subscribed) {
|
||||||
|
Messages.subscribe(PLAYBACK_CHANNEL);
|
||||||
|
subscribed = true;
|
||||||
|
Recording.loadRecording(clip_url);
|
||||||
|
print("I'm the agent and I am ready to receive!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Messages.messageReceived.connect(function (channel, message, senderID) {
|
||||||
|
if (channel == PLAYBACK_CHANNEL) {
|
||||||
|
getAction(channel, message, senderID);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.update.connect(update);
|
|
@ -0,0 +1,217 @@
|
||||||
|
//
|
||||||
|
// overlayPanelExample.js
|
||||||
|
// examples/example/ui
|
||||||
|
//
|
||||||
|
// Created by Alexander Otavka
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
|
||||||
|
Script.include([
|
||||||
|
"../../libraries/globals.js",
|
||||||
|
"../../libraries/overlayManager.js",
|
||||||
|
]);
|
||||||
|
var TOOL_ICON_URL = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
|
var BG_IMAGE_URL = TOOL_ICON_URL + "recording-record.svg"
|
||||||
|
var RED_DOT_IMAGE_URL = TOOL_ICON_URL + "play-pause.svg";
|
||||||
|
var BLUE_SQUARE_IMAGE_URL = TOOL_ICON_URL + "recording-save.svg";
|
||||||
|
|
||||||
|
var mainPanel = new OverlayPanel({
|
||||||
|
anchorPositionBinding: { avatar: "MyAvatar" },
|
||||||
|
offsetPosition: { x: 0, y: 0.4, z: -1 },
|
||||||
|
isFacingAvatar: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var bluePanel = mainPanel.addChild(new OverlayPanel ({
|
||||||
|
offsetPosition: { x: 0.1, y: 0.1, z: 0.2 },
|
||||||
|
offsetScale: 0.5
|
||||||
|
}));
|
||||||
|
|
||||||
|
var mainPanelBackground = new Image3DOverlay({
|
||||||
|
url: BG_IMAGE_URL,
|
||||||
|
dimensions: {
|
||||||
|
x: 0.5,
|
||||||
|
y: 0.5,
|
||||||
|
},
|
||||||
|
isFacingAvatar: false,
|
||||||
|
alpha: 1.0,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: -0.001
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var bluePanelBackground = mainPanelBackground.clone();
|
||||||
|
|
||||||
|
mainPanel.addChild(mainPanelBackground);
|
||||||
|
bluePanel.addChild(bluePanelBackground);
|
||||||
|
|
||||||
|
var textWidth = .25;
|
||||||
|
var textHeight = .1;
|
||||||
|
var numberOfLines = 1;
|
||||||
|
var textMargin = 0.00625;
|
||||||
|
var lineHeight = (textHeight - (2 * textMargin)) / numberOfLines;
|
||||||
|
|
||||||
|
var text = mainPanel.addChild(new Text3DOverlay({
|
||||||
|
text: "TEXT",
|
||||||
|
isFacingAvatar: false,
|
||||||
|
alpha: 1.0,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: 0.1,
|
||||||
|
y: -0.15,
|
||||||
|
z: 0.001
|
||||||
|
},
|
||||||
|
dimensions: { x: textWidth, y: textHeight },
|
||||||
|
backgroundColor: { red: 0, green: 0, blue: 0 },
|
||||||
|
color: { red: 255, green: 255, blue: 255 },
|
||||||
|
topMargin: textMargin,
|
||||||
|
leftMargin: textMargin,
|
||||||
|
bottomMargin: textMargin,
|
||||||
|
rightMargin: textMargin,
|
||||||
|
lineHeight: lineHeight,
|
||||||
|
alpha: 0.9,
|
||||||
|
backgroundAlpha: 0.9
|
||||||
|
}));
|
||||||
|
|
||||||
|
var redDot = mainPanel.addChild(new Image3DOverlay({
|
||||||
|
url: RED_DOT_IMAGE_URL,
|
||||||
|
dimensions: {
|
||||||
|
x: 0.1,
|
||||||
|
y: 0.1,
|
||||||
|
},
|
||||||
|
isFacingAvatar: true,
|
||||||
|
alpha: 1.0,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: -0.15,
|
||||||
|
y: -0.15,
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
var redDot2 = mainPanel.addChild(new Image3DOverlay({
|
||||||
|
url: RED_DOT_IMAGE_URL,
|
||||||
|
dimensions: {
|
||||||
|
x: 0.1,
|
||||||
|
y: 0.1,
|
||||||
|
},
|
||||||
|
isFacingAvatar: true,
|
||||||
|
alpha: 1.0,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: -0.155,
|
||||||
|
y: 0.005,
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
var blueSquare = bluePanel.addChild(new Image3DOverlay({
|
||||||
|
url: BLUE_SQUARE_IMAGE_URL,
|
||||||
|
dimensions: {
|
||||||
|
x: 0.15,
|
||||||
|
y: 0.15,
|
||||||
|
},
|
||||||
|
isFacingAvatar: false,
|
||||||
|
alpha: 1.0,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: 0.09,
|
||||||
|
y: -0.09,
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
var blueSquare2 = bluePanel.addChild(new Image3DOverlay({
|
||||||
|
url: BLUE_SQUARE_IMAGE_URL,
|
||||||
|
dimensions: {
|
||||||
|
x: 0.15,
|
||||||
|
y: 0.15,
|
||||||
|
},
|
||||||
|
isFacingAvatar: false,
|
||||||
|
alpha: 1.0,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: 0.09,
|
||||||
|
y: 0.09,
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
var blueSquare3 = blueSquare2.clone();
|
||||||
|
blueSquare3.offsetPosition = {
|
||||||
|
x: -0.09,
|
||||||
|
y: 0.09,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var mouseDown = {};
|
||||||
|
|
||||||
|
function onMouseDown(event) {
|
||||||
|
if (event.isLeftButton) {
|
||||||
|
//mouseDown.overlay = OverlayManager.findAtPoint({ x: event.x, y: event.y });
|
||||||
|
//this.getHandPosition = MyAvatar.getRightPalmPosition;
|
||||||
|
//this.getHandRotation = MyAvatar.getRightPalmRotation;
|
||||||
|
var handPosition = MyAvatar.getRightPalmPosition();
|
||||||
|
var pickRay = {
|
||||||
|
origin: handPosition,
|
||||||
|
direction: Quat.getUp(MyAvatar.getRightPalmRotation())
|
||||||
|
//direction: MyAvatar.orientation
|
||||||
|
};
|
||||||
|
//pickRay = Camera.computePickRay(event.x, event.y); //class PickRay - vec3 origin, vec3 direction
|
||||||
|
//pickRay = Camera.computePickRay(handPosition.x, handPosition.y);
|
||||||
|
print("MOUSE: " + event.x + " - " + event.y);
|
||||||
|
print("HAND: " + handPosition.x + " - " + handPosition.y);
|
||||||
|
mouseDown.overlay = OverlayManager.findOnRay(pickRay);
|
||||||
|
}
|
||||||
|
if (event.isRightButton) {
|
||||||
|
mouseDown.pos = { x: event.x, y: event.y };
|
||||||
|
}
|
||||||
|
mouseDown.maxDistance = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseMove(event) {
|
||||||
|
if (mouseDown.maxDistance !== undefined) {
|
||||||
|
var dist = Vec3.distance(mouseDown.pos, { x: event.x, y: event.y });
|
||||||
|
if (dist > mouseDown.maxDistance) {
|
||||||
|
mouseDown.maxDistance = dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseUp(event) {
|
||||||
|
if (event.isLeftButton) {
|
||||||
|
var handPosition = MyAvatar.getRightPalmPosition();
|
||||||
|
var pickRay = {
|
||||||
|
origin: handPosition,
|
||||||
|
direction: Quat.getUp(MyAvatar.getRightPalmRotation())
|
||||||
|
//direction: MyAvatar.orientation
|
||||||
|
};
|
||||||
|
//pickRay = Camera.computePickRay(event.x, event.y); //class PickRay - vec3 origin, vec3 direction
|
||||||
|
//pickRay = Camera.computePickRay(handPosition.x, handPosition.y);
|
||||||
|
var overlay = OverlayManager.findOnRay(pickRay);
|
||||||
|
if (overlay && overlay === mouseDown.overlay) {
|
||||||
|
if (overlay.parentPanel === bluePanel) {
|
||||||
|
overlay.destroy();
|
||||||
|
} else {
|
||||||
|
overlay.offsetPosition = Vec3.sum(overlay.offsetPosition, { x: 0, y: 0, z: -0.1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (event.isRightButton && mouseDown.maxDistance < 10) {
|
||||||
|
mainPanel.visible = !mainPanel.visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onScriptEnd() {
|
||||||
|
mainPanel.destroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
Controller.mousePressEvent.connect(onMouseDown);
|
||||||
|
Controller.mouseMoveEvent.connect(onMouseMove);
|
||||||
|
Controller.mouseReleaseEvent.connect(onMouseUp);
|
||||||
|
Script.scriptEnding.connect(onScriptEnd);
|
|
@ -0,0 +1,314 @@
|
||||||
|
//
|
||||||
|
// detectGrabExample.js
|
||||||
|
// examples/entityScripts
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 9/3/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// This is an example of an entity script which when assigned to an entity, will detect when the entity is being grabbed by the hydraGrab script
|
||||||
|
//
|
||||||
|
// 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 HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/libraries/utils.js");
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/libraries/overlayManager.js");
|
||||||
|
//Script.include("C:\\Users\\Proprietario\\Desktop\\overlayManager.js"); //doesn't work
|
||||||
|
//Script.include('../libraries/overlayManager.js'); //doesn't work
|
||||||
|
//Script.include("http://s3.amazonaws.com/hifi-content/alessandro/dev/JS/libraries/overlayManager.js");
|
||||||
|
|
||||||
|
//var BROWN_ICON_URL = "http://cdn.highfidelity.com/alan/production/icons/ICO_rec-active.svg";
|
||||||
|
var BROWN_ICON_URL = "https://dl.dropboxusercontent.com/u/14127429/FBX/VRshop/UI_Brown.svg";
|
||||||
|
var RED_ICON_URL = "https://dl.dropboxusercontent.com/u/14127429/FBX/VRshop/UI_Red.svg";
|
||||||
|
var BLACK_ICON_URL = "https://dl.dropboxusercontent.com/u/14127429/FBX/VRshop/UI_Black.svg";
|
||||||
|
|
||||||
|
var ICONS = [
|
||||||
|
BROWN_ICON_URL,
|
||||||
|
RED_ICON_URL,
|
||||||
|
BLACK_ICON_URL
|
||||||
|
];
|
||||||
|
|
||||||
|
var MIN_DIMENSION_THRESHOLD = null;
|
||||||
|
var IN_HAND_STATUS = "inHand";
|
||||||
|
var IN_INSPECT_STATUS = "inInspect";
|
||||||
|
|
||||||
|
var RIGHT_HAND = 1;
|
||||||
|
var LEFT_HAND = 0;
|
||||||
|
|
||||||
|
var LINE_LENGTH = 100;
|
||||||
|
var COLOR = {
|
||||||
|
red: 10,
|
||||||
|
green: 10,
|
||||||
|
blue: 255
|
||||||
|
};
|
||||||
|
|
||||||
|
var COMFORT_ARM_LENGTH = 0.5;
|
||||||
|
|
||||||
|
var PENETRATION_THRESHOLD = 0.2;
|
||||||
|
|
||||||
|
var _this;
|
||||||
|
var inspecting = false;
|
||||||
|
var isUIWorking = false;
|
||||||
|
var inspectingMyItem = false;
|
||||||
|
var waitingForBumpReleased = false;
|
||||||
|
var rightController = null; //rightController and leftController are two objects
|
||||||
|
var leftController = null;
|
||||||
|
var zoneID = null;
|
||||||
|
var inspectedEntityID = null;
|
||||||
|
|
||||||
|
var newPosition = null;
|
||||||
|
var newRotation = null;
|
||||||
|
|
||||||
|
var mainPanel = null;
|
||||||
|
var buttons = [];
|
||||||
|
|
||||||
|
|
||||||
|
// this is the "constructor" for the entity as a JS object we don't do much here, but we do want to remember
|
||||||
|
// our this object, so we can access it in cases where we're called without a this (like in the case of various global signals)
|
||||||
|
InspectEntity = function() {
|
||||||
|
_this = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function MyController(hand) {
|
||||||
|
print("created hand: " + hand);
|
||||||
|
this.hand = hand;
|
||||||
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
this.getHandPosition = MyAvatar.getRightPalmPosition;
|
||||||
|
this.getHandRotation = MyAvatar.getRightPalmRotation;
|
||||||
|
this.bumper = Controller.Standard.RB;
|
||||||
|
} else {
|
||||||
|
this.getHandPosition = MyAvatar.getLeftPalmPosition;
|
||||||
|
this.getHandRotation = MyAvatar.getLeftPalmRotation;
|
||||||
|
this.bumper = Controller.Standard.LB;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pickRay = null; // ray object
|
||||||
|
this.overlayLine = null; // id of line overlay
|
||||||
|
this.waitingForBumpReleased = false;
|
||||||
|
|
||||||
|
this.overlayLineOn = function(closePoint, farPoint, color) {
|
||||||
|
if (this.overlayLine == null) {
|
||||||
|
var lineProperties = {
|
||||||
|
lineWidth: 5,
|
||||||
|
start: closePoint,
|
||||||
|
end: farPoint,
|
||||||
|
color: color,
|
||||||
|
ignoreRayIntersection: true, // ??
|
||||||
|
visible: true,
|
||||||
|
alpha: 1
|
||||||
|
};
|
||||||
|
this.overlayLine = new Line3DOverlay(lineProperties);
|
||||||
|
} else {
|
||||||
|
this.overlayLine.start = closePoint;
|
||||||
|
this.overlayLine.end = farPoint;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
//the update of each hand has to update the ray belonging to that hand and handle the bumper event
|
||||||
|
this.updateHand = function() {
|
||||||
|
//update the ray object
|
||||||
|
this.pickRay = {
|
||||||
|
origin: this.getHandPosition(),
|
||||||
|
direction: Quat.getUp(this.getHandRotation())
|
||||||
|
};
|
||||||
|
//update the ray overlay
|
||||||
|
this.overlayLineOn(this.pickRay.origin, Vec3.sum(this.pickRay.origin, Vec3.multiply(this.pickRay.direction, LINE_LENGTH)), COLOR);
|
||||||
|
|
||||||
|
//detect the bumper event
|
||||||
|
//manage event on UI
|
||||||
|
var bumperPressed = Controller.getValue(this.bumper);
|
||||||
|
if (bumperPressed && !this.waitingForBumpReleased) {
|
||||||
|
this.waitingForBumpReleased = true;
|
||||||
|
var triggeredButton = OverlayManager.findOnRay(this.pickRay);
|
||||||
|
if (triggeredButton != null) {
|
||||||
|
for (var i = 0; i < buttons.length; i++) {
|
||||||
|
if (buttons[i] == triggeredButton) {
|
||||||
|
var dataJSON = {
|
||||||
|
index: i
|
||||||
|
};
|
||||||
|
var dataArray = [JSON.stringify(dataJSON)];
|
||||||
|
|
||||||
|
Entities.callEntityMethod(inspectedEntityID, 'changeModel', dataArray);
|
||||||
|
print("ChangeColor by ID: " + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!bumperPressed && this.waitingForBumpReleased) {
|
||||||
|
this.waitingForBumpReleased = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
this.clean = function() {
|
||||||
|
this.pickRay = null;
|
||||||
|
this.overlayLine.destroy();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function update(deltaTime) {
|
||||||
|
//the if condition should depend from other stuff
|
||||||
|
if (inspecting) {
|
||||||
|
//update the rays from both hands
|
||||||
|
leftController.updateHand();
|
||||||
|
rightController.updateHand();
|
||||||
|
|
||||||
|
//check the item status for consistency
|
||||||
|
var entityStatus = getEntityCustomData('statusKey', inspectedEntityID, null).status;
|
||||||
|
if (entityStatus == IN_HAND_STATUS) {
|
||||||
|
//the inspection is over
|
||||||
|
inspecting = false;
|
||||||
|
inspectedEntityID = null;
|
||||||
|
}
|
||||||
|
} else if (isUIWorking) {
|
||||||
|
//clean all the UI stuff
|
||||||
|
// Destroy rays
|
||||||
|
leftController.clean();
|
||||||
|
rightController.clean();
|
||||||
|
// Destroy overlay
|
||||||
|
mainPanel.destroy();
|
||||||
|
isUIWorking = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.positionRotationUpdate();
|
||||||
|
};
|
||||||
|
|
||||||
|
InspectEntity.prototype = {
|
||||||
|
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
print("PRELOAD INSPECT ENTITY");
|
||||||
|
//get the owner ID from user data and compare to the mine
|
||||||
|
//the update will be connected just for the owner
|
||||||
|
var ownerObj = getEntityCustomData('ownerKey', this.entityID, null);
|
||||||
|
if (ownerObj.ownerID === MyAvatar.sessionUUID) {
|
||||||
|
rightController = new MyController(RIGHT_HAND); //rightController and leftController are two objects
|
||||||
|
leftController = new MyController(LEFT_HAND);
|
||||||
|
inspectingMyItem = true;
|
||||||
|
inspectRadius = (Entities.getEntityProperties(_this.entityID).dimensions.x) / 2 + COMFORT_ARM_LENGTH;
|
||||||
|
Script.update.connect(update);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
doSomething: function (entityID, dataArray) {
|
||||||
|
var data = JSON.parse(dataArray[0]);
|
||||||
|
var itemOwnerObj = getEntityCustomData('ownerKey', data.id, null);
|
||||||
|
//print("------- The owner of the item is: " + ((itemOwnerObj == null) ? itemOwnerObj : itemOwnerObj.ownerID));
|
||||||
|
//print("item ID: " + data.id);
|
||||||
|
|
||||||
|
var inspectOwnerObj = getEntityCustomData('ownerKey', this.entityID, null);
|
||||||
|
//print("------- The owner of the inspectZone is: " + ((inspectOwnerObj == null) ? inspectOwnerObj : inspectOwnerObj.ownerID));
|
||||||
|
//print("zone ID: " + this.entityID);
|
||||||
|
|
||||||
|
if (inspectOwnerObj == null) {
|
||||||
|
//print("The inspectZone doesn't have a owner.");
|
||||||
|
Entities.deleteEntity(data.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (itemOwnerObj.ownerID === inspectOwnerObj.ownerID) {
|
||||||
|
//setup the things for inspecting the item
|
||||||
|
inspecting = true;
|
||||||
|
inspectedEntityID = data.id; //store the ID of the inspected entity
|
||||||
|
setEntityCustomData('statusKey', data.id, {
|
||||||
|
status: IN_INSPECT_STATUS
|
||||||
|
});
|
||||||
|
//print("Set status!");
|
||||||
|
|
||||||
|
_this.createInspectUI();
|
||||||
|
|
||||||
|
Entities.editEntity(_this.entityID, { visible: false });
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//print("Not your inspect zone!");
|
||||||
|
Entities.deleteEntity(data.id);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
positionRotationUpdate: function() {
|
||||||
|
//position
|
||||||
|
newPosition = Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.getOrientation()), inspectRadius));
|
||||||
|
Entities.editEntity(_this.entityID, { position: newPosition });
|
||||||
|
|
||||||
|
newRotation = Camera.getOrientation();
|
||||||
|
Entities.editEntity(_this.entityID, { rotation: newRotation });
|
||||||
|
},
|
||||||
|
|
||||||
|
createInspectUI : function() {
|
||||||
|
//print ("Creating UI");
|
||||||
|
|
||||||
|
//set the main panel to follow the inspect entity
|
||||||
|
mainPanel = new OverlayPanel({
|
||||||
|
anchorPositionBinding: { entity: _this.entityID },
|
||||||
|
isFacingAvatar: true
|
||||||
|
});
|
||||||
|
|
||||||
|
var offsetPositionY = 0.2;
|
||||||
|
var offsetPositionX = -0.4;
|
||||||
|
|
||||||
|
for (var i = 0; i < ICONS.length; i++) {
|
||||||
|
//print("creating button " + ICONS[i]);
|
||||||
|
buttons[i] = new Image3DOverlay({
|
||||||
|
url: ICONS[i],
|
||||||
|
dimensions: {
|
||||||
|
x: 0.15,
|
||||||
|
y: 0.15
|
||||||
|
},
|
||||||
|
isFacingAvatar: false,
|
||||||
|
alpha: 0.8,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: offsetPositionX,
|
||||||
|
y: offsetPositionY - (i * offsetPositionY),
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
mainPanel.addChild(buttons[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
isUIWorking = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
collisionWithEntity: function(myID, otherID, collisionInfo) {
|
||||||
|
//print("SHOE COLLISION: " + collisionInfo.penetration.x + " - " + collisionInfo.penetration.y + " - " + collisionInfo.penetration.z);
|
||||||
|
//var penetrationValue = collisionInfo.penetration.x + collisionInfo.penetration.y + collisionInfo.penetration.z;
|
||||||
|
var penetrationValue = Vec3.length(collisionInfo.penetration);
|
||||||
|
//print("Value: " + penetrationValue);
|
||||||
|
if (penetrationValue > PENETRATION_THRESHOLD && zoneID === null) {
|
||||||
|
zoneID = otherID;
|
||||||
|
print("Zone: " + zoneID);
|
||||||
|
|
||||||
|
var itemObj = getEntityCustomData('itemKey', this.entityID, null);
|
||||||
|
//print("------- The entity in the inspect zone is: " + ((itemObj == null) ? itemObj : itemObj.itemID));
|
||||||
|
|
||||||
|
if (itemObj != null) {
|
||||||
|
if (itemObj.itemID == otherID) {
|
||||||
|
// change overlay color
|
||||||
|
//print("Going to call the change color to red");
|
||||||
|
Entities.callEntityMethod(otherID, 'changeOverlayColor', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (penetrationValue < PENETRATION_THRESHOLD && zoneID !== null) {
|
||||||
|
zoneID = null;
|
||||||
|
//print("Zone: " + zoneID);
|
||||||
|
//print("Going to call the change color to green");
|
||||||
|
Entities.callEntityMethod(otherID, 'changeOverlayColor', null);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
unload: function (entityID) {
|
||||||
|
if(inspectingMyItem){
|
||||||
|
print("UNLOAD INSPECT ENTITY");
|
||||||
|
Script.update.disconnect(update);
|
||||||
|
|
||||||
|
// clean UI
|
||||||
|
Entities.deleteEntity(_this.entityID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return new InspectEntity();
|
||||||
|
})
|
374
hifi-content/alessandro/dev/JS/Misc/shopItemEntityScript.js
Normal file
374
hifi-content/alessandro/dev/JS/Misc/shopItemEntityScript.js
Normal file
|
@ -0,0 +1,374 @@
|
||||||
|
//
|
||||||
|
// detectGrabExample.js
|
||||||
|
// examples/entityScripts
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 9/3/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// This is an example of an entity script which when assigned to an entity, will detect when the entity is being grabbed by the hydraGrab script
|
||||||
|
//
|
||||||
|
// 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 HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/libraries/utils.js");
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/libraries/overlayManager.js");
|
||||||
|
//Script.include("C:\\Users\\Proprietario\\Desktop\\overlayManager.js");
|
||||||
|
//Script.include('../libraries/overlayManager.js'); //doesn't work
|
||||||
|
//Script.include("http://s3.amazonaws.com/hifi-content/alessandro/dev/JS/libraries/overlayManager.js");
|
||||||
|
//Script.include("http://s3.amazonaws.com/hifi-public/scripts/libraries/overlayManager.js");
|
||||||
|
|
||||||
|
|
||||||
|
var TOOL_ICON_URL = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
|
var RED_IMAGE_URL = "https://dl.dropboxusercontent.com/u/14127429/FBX/VRshop/inspRED.png";
|
||||||
|
var GREEN_IMAGE_URL = "https://dl.dropboxusercontent.com/u/14127429/FBX/VRshop/inspGREEN.png";
|
||||||
|
var MIN_DIMENSION_THRESHOLD = null;
|
||||||
|
var MAX_DIMENSION_THRESHOLD = null;
|
||||||
|
var PENETRATION_THRESHOLD = 0.2;
|
||||||
|
var MAPPING_NAME = "controllerMapping_Inspection";
|
||||||
|
|
||||||
|
var _this;
|
||||||
|
var hand;
|
||||||
|
var onShelf = true;
|
||||||
|
var inspecting = false;
|
||||||
|
var inCart = false;
|
||||||
|
var overlayInspectRed = true;
|
||||||
|
var zoneID = null;
|
||||||
|
var newPosition;
|
||||||
|
var originalDimensions = null;
|
||||||
|
var deltaLX = 0;
|
||||||
|
var deltaLY = 0;
|
||||||
|
var deltaRX = 0;
|
||||||
|
var deltaRY = 0;
|
||||||
|
var radius;
|
||||||
|
var inspectingEntity = null;
|
||||||
|
var inspectPanel = null;
|
||||||
|
var background = null;
|
||||||
|
var modelURLsArray = [];
|
||||||
|
|
||||||
|
// this is the "constructor" for the entity as a JS object we don't do much here, but we do want to remember
|
||||||
|
// our this object, so we can access it in cases where we're called without a this (like in the case of various global signals)
|
||||||
|
DetectGrabbed = function() {
|
||||||
|
_this = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
function update(deltaTime) {
|
||||||
|
if(inspecting){
|
||||||
|
_this.orientationPositionUpdate();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
DetectGrabbed.prototype = {
|
||||||
|
|
||||||
|
// preload() will be called when the entity has become visible (or known) to the interface
|
||||||
|
// it gives us a chance to set our local JavaScript object up. In this case it means:
|
||||||
|
// * remembering our entityID, so we can access it in cases where we're called without an entityID
|
||||||
|
// * connecting to the update signal so we can check our grabbed state
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
Script.update.connect(update);
|
||||||
|
|
||||||
|
MIN_DIMENSION_THRESHOLD = Vec3.length(Entities.getEntityProperties(this.entityID).dimensions)/2;
|
||||||
|
MAX_DIMENSION_THRESHOLD = Vec3.length(Entities.getEntityProperties(this.entityID).dimensions)*2;
|
||||||
|
radius = Vec3.length(Entities.getEntityProperties(this.entityID).dimensions) / 2.0;
|
||||||
|
//inspectRadius = Vec3.length(Entities.getEntityProperties(this.entityID).dimensions) / 2.0; //??
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
setRightHand: function () {
|
||||||
|
//print("I am being held in a right hand... entity:" + this.entityID);
|
||||||
|
hand = MyAvatar.rightHandPose;
|
||||||
|
},
|
||||||
|
|
||||||
|
setLeftHand: function () {
|
||||||
|
//print("I am being held in a left hand... entity:" + this.entityID);
|
||||||
|
hand = MyAvatar.leftHandPose;
|
||||||
|
},
|
||||||
|
|
||||||
|
createInspectOverlay: function (entityBindID) {
|
||||||
|
//print ("Creating overlay");
|
||||||
|
inspectPanel = new OverlayPanel({
|
||||||
|
anchorPositionBinding: { entity: entityBindID },
|
||||||
|
//anchorRotationBinding: { entity: entityBindID },
|
||||||
|
//offsetPosition: { x: 0, y: 0, z: 0 },
|
||||||
|
isFacingAvatar: true
|
||||||
|
});
|
||||||
|
|
||||||
|
background = new Image3DOverlay({
|
||||||
|
url: RED_IMAGE_URL,
|
||||||
|
dimensions: {
|
||||||
|
x: 0.6,
|
||||||
|
y: 0.6,
|
||||||
|
},
|
||||||
|
isFacingAvatar: false,
|
||||||
|
alpha: 1,
|
||||||
|
ignoreRayIntersection: false,
|
||||||
|
offsetPosition: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
inspectPanel.addChild(background);
|
||||||
|
|
||||||
|
//print ("Overlay created");
|
||||||
|
|
||||||
|
// backgroundGREEN = new Image3DOverlay({
|
||||||
|
// url: GREEN_IMAGE_URL,
|
||||||
|
// dimensions: {
|
||||||
|
// x: 0.5,
|
||||||
|
// y: 0.5,
|
||||||
|
// },
|
||||||
|
// isFacingAvatar: false,
|
||||||
|
// alpha: 0.8,
|
||||||
|
// ignoreRayIntersection: false,
|
||||||
|
// offsetPosition: {
|
||||||
|
// x: 0,
|
||||||
|
// y: 0,
|
||||||
|
// z: -0.001
|
||||||
|
// },
|
||||||
|
// visible: false
|
||||||
|
// });
|
||||||
|
|
||||||
|
// inspectPanel.addChild(backgroundGREEN);
|
||||||
|
},
|
||||||
|
|
||||||
|
changeOverlayColor: function () {
|
||||||
|
if (overlayInspectRed) {
|
||||||
|
//print ("Change color of overlay to green");
|
||||||
|
overlayInspectRed = false;
|
||||||
|
//background.dimensions = Vec3.sum(background.dimension, { x: 1, y: 1, z: 1 });
|
||||||
|
// backgroundRED.visible = overlayInspectRed;
|
||||||
|
// backgroundGREEN.visible = !overlayInspectRed;
|
||||||
|
background.url = GREEN_IMAGE_URL;
|
||||||
|
} else {
|
||||||
|
//print ("Change color of overlay to red");
|
||||||
|
overlayInspectRed = true;
|
||||||
|
//background.dimensions = Vec3.sum(background.dimension, { x: 1, y: 1, z: 1 });
|
||||||
|
// backgroundRED.visible = overlayInspectRed;
|
||||||
|
// backgroundGREEN.visible = !overlayInspectRed;
|
||||||
|
background.url = RED_IMAGE_URL;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
startNearGrab: function () {
|
||||||
|
|
||||||
|
print("I was just grabbed... entity:" + this.entityID);
|
||||||
|
Entities.editEntity(this.entityID, { ignoreForCollisions: false });
|
||||||
|
Entities.editEntity(this.entityID, { dimensions: originalDimensions });
|
||||||
|
|
||||||
|
// Everytime we grab, we create the inspectEntity and the inspectAreaOverlay in front of the avatar
|
||||||
|
|
||||||
|
|
||||||
|
if(!inspecting) {
|
||||||
|
var entityProperties = Entities.getEntityProperties(this.entityID);
|
||||||
|
|
||||||
|
inspectingEntity = Entities.addEntity({
|
||||||
|
type: "Box",
|
||||||
|
name: "inspectionEntity",
|
||||||
|
//position: Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.getOrientation()), inspectRadius * 3.0)), // maybe we can avoid to set this here
|
||||||
|
dimensions: {x: 0.5, y: 0.5, z: 0.5}, //??
|
||||||
|
//rotation: entityProperties.rotation,
|
||||||
|
collisionsWillMove: false,
|
||||||
|
ignoreForCollisions: false,
|
||||||
|
visible: false,
|
||||||
|
script: "https://hifi-content.s3.amazonaws.com/alessandro/dev/JS/Inspect/shopInspectEntityScript.js", // I don't know, ask desktop
|
||||||
|
userData: JSON.stringify({
|
||||||
|
ownerKey: {
|
||||||
|
ownerID: MyAvatar.sessionUUID
|
||||||
|
},
|
||||||
|
itemKey: {
|
||||||
|
itemID: this.entityID
|
||||||
|
},
|
||||||
|
grabbableKey: {
|
||||||
|
grabbable: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.createInspectOverlay(inspectingEntity);
|
||||||
|
//print("Got after the creation!");
|
||||||
|
|
||||||
|
if (inspecting === true) {
|
||||||
|
inspecting = false;
|
||||||
|
//deletentityforinspecting
|
||||||
|
Controller.disableMapping(MAPPING_NAME);
|
||||||
|
setEntityCustomData('statusKey', this.entityID, {
|
||||||
|
status: "inHand"
|
||||||
|
});
|
||||||
|
} else if (onShelf === true) {
|
||||||
|
//create a copy of this entity if it is the first grab
|
||||||
|
var entityProperties = Entities.getEntityProperties(this.entityID);
|
||||||
|
|
||||||
|
Entities.addEntity({
|
||||||
|
type: entityProperties.type,
|
||||||
|
name: entityProperties.name,
|
||||||
|
position: entityProperties.position,
|
||||||
|
dimensions: entityProperties.dimensions,
|
||||||
|
rotation: entityProperties.rotation,
|
||||||
|
collisionsWillMove: false,
|
||||||
|
ignoreForCollisions: true,
|
||||||
|
modelURL: entityProperties.modelURL,
|
||||||
|
shapeType: entityProperties.shapeType,
|
||||||
|
originalTextures: entityProperties.originalTextures,
|
||||||
|
script: entityProperties.script,
|
||||||
|
});
|
||||||
|
|
||||||
|
onShelf = false;
|
||||||
|
setEntityCustomData('ownerKey', this.entityID, {
|
||||||
|
ownerID: MyAvatar.sessionUUID
|
||||||
|
});
|
||||||
|
originalDimensions = entityProperties.dimensions;
|
||||||
|
|
||||||
|
|
||||||
|
//var url = Window.prompt("Insert the url of the JSON: ","");
|
||||||
|
var url = "atp://ead2a69e8e0d7b9d9a443e85f4b588f7daeda54c8a20a0dc5b88e6e33c13a398.txt";
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
|
||||||
|
//Retrieve the url from the userData
|
||||||
|
//var url = getEntityCustomData('jsonKey', this.entityID, null);
|
||||||
|
|
||||||
|
Assets.downloadData(url, function (data) {
|
||||||
|
print("data downloaded from:" + url);
|
||||||
|
//printPerformanceJSON(JSON.parse(data));
|
||||||
|
var obj = JSON.parse(data);
|
||||||
|
var modelURLs = obj.modelURLs;
|
||||||
|
|
||||||
|
modelURLs.forEach(function(param) {
|
||||||
|
modelURLsArray[i] = param;
|
||||||
|
print("url obtained: " + modelURLsArray[i]);
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if (inCart === true) {
|
||||||
|
print("GOT IN inCart BRANCH");
|
||||||
|
inCart = false;
|
||||||
|
setEntityCustomData('statusKey', this.entityID, {
|
||||||
|
status: "inHand"
|
||||||
|
});
|
||||||
|
var dataJSON = {
|
||||||
|
id: this.entityID
|
||||||
|
};
|
||||||
|
var dataArray = [JSON.stringify(dataJSON)];
|
||||||
|
print("Going to refresh!");
|
||||||
|
Entities.callEntityMethod(zoneID, 'refreshCartContent', dataArray);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
continueNearGrab: function () {
|
||||||
|
//print("I am still being grabbed... entity:" + this.entityID);
|
||||||
|
},
|
||||||
|
|
||||||
|
releaseGrab: function () {
|
||||||
|
|
||||||
|
print("I was released... entity:" + this.entityID);
|
||||||
|
Entities.editEntity(this.entityID, { ignoreForCollisions: true });
|
||||||
|
print("zoneID is " + zoneID);
|
||||||
|
|
||||||
|
// Destroy overlay
|
||||||
|
inspectPanel.destroy();
|
||||||
|
|
||||||
|
if (zoneID !== null) {
|
||||||
|
|
||||||
|
print("Got here. Entity ID is: " + this.entityID);
|
||||||
|
//Entities.callEntityMethod(zoneID, 'doSomething', this.entityID);
|
||||||
|
var dataJSON = {
|
||||||
|
id: this.entityID
|
||||||
|
};
|
||||||
|
var dataArray = [JSON.stringify(dataJSON)];
|
||||||
|
Entities.callEntityMethod(zoneID, 'doSomething', dataArray);
|
||||||
|
|
||||||
|
var statusObj = getEntityCustomData('statusKey', this.entityID, null);
|
||||||
|
|
||||||
|
//print("ZONE ID NOT NULL AND STATUS IS: " + statusObj.status);
|
||||||
|
|
||||||
|
if (statusObj.status == "inInspect") { // if I'm releasing in the inspectZone
|
||||||
|
inspecting = true;
|
||||||
|
print("released inside the inspection area");
|
||||||
|
|
||||||
|
var mapping = Controller.newMapping(MAPPING_NAME);
|
||||||
|
mapping.from(Controller.Standard.LX).to(function (value) {
|
||||||
|
deltaLX = value;
|
||||||
|
});
|
||||||
|
mapping.from(Controller.Standard.LY).to(function (value) {
|
||||||
|
deltaLY = value;
|
||||||
|
});
|
||||||
|
mapping.from(Controller.Standard.RX).to(function (value) {
|
||||||
|
deltaRX = value;
|
||||||
|
});
|
||||||
|
mapping.from(Controller.Standard.RY).to(function (value) {
|
||||||
|
deltaRY = value;
|
||||||
|
});
|
||||||
|
Controller.enableMapping(MAPPING_NAME);
|
||||||
|
} else if (statusObj.status == "inCart") { // in cart
|
||||||
|
Entities.deleteEntity(inspectingEntity);
|
||||||
|
print("inCart is TRUE");
|
||||||
|
inCart = true;
|
||||||
|
} else { // any other zone
|
||||||
|
Entities.deleteEntity(inspectingEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else { // ZoneID is null, released somewhere that is not a zone
|
||||||
|
Entities.deleteEntity(inspectingEntity);
|
||||||
|
Entities.deleteEntity(this.entityID);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
collisionWithEntity: function(myID, otherID, collisionInfo) {
|
||||||
|
//print("SHOE COLLISION: " + collisionInfo.penetration.x + " - " + collisionInfo.penetration.y + " - " + collisionInfo.penetration.z);
|
||||||
|
//var penetrationValue = collisionInfo.penetration.x + collisionInfo.penetration.y + collisionInfo.penetration.z;
|
||||||
|
var penetrationValue = Vec3.length(collisionInfo.penetration);
|
||||||
|
//print("Value: " + penetrationValue);
|
||||||
|
if (penetrationValue > PENETRATION_THRESHOLD && zoneID === null) {
|
||||||
|
zoneID = otherID;
|
||||||
|
print("Zone: " + zoneID);
|
||||||
|
} else if (penetrationValue < PENETRATION_THRESHOLD && zoneID !== null) {
|
||||||
|
zoneID = null;
|
||||||
|
print("Zone: " + zoneID);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
orientationPositionUpdate: function() {
|
||||||
|
//position
|
||||||
|
//var radius = Vec3.length(Entities.getEntityProperties(this.entityID).dimensions) / 2.0;
|
||||||
|
//newPosition = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(Quat.getFront(MyAvatar.orientation), radius * 3.0)); // we need to tune this because we don't want it in the center but on the left
|
||||||
|
newPosition = Vec3.sum(Camera.position, Vec3.multiply(Quat.getFront(Camera.getOrientation()), radius * 3.0)); // we need to tune this because we don't want it in the center but on the left
|
||||||
|
|
||||||
|
Entities.editEntity(_this.entityID, { position: newPosition });
|
||||||
|
//orientation
|
||||||
|
var newRotation = Quat.multiply(Entities.getEntityProperties(_this.entityID).rotation, Quat.fromPitchYawRollDegrees(deltaLY*10, deltaLX*10, 0))
|
||||||
|
Entities.editEntity(_this.entityID, { rotation: newRotation });
|
||||||
|
//zoom
|
||||||
|
var oldDimension = Entities.getEntityProperties(_this.entityID).dimensions;
|
||||||
|
var scaleFactor = (deltaRY * 0.1) + 1;
|
||||||
|
if (!((Vec3.length(oldDimension) < MIN_DIMENSION_THRESHOLD && scaleFactor < 1) || (Vec3.length(oldDimension) > MAX_DIMENSION_THRESHOLD && scaleFactor > 1))) {
|
||||||
|
var newDimension = Vec3.multiply(oldDimension, scaleFactor);
|
||||||
|
Entities.editEntity(_this.entityID, { dimensions: newDimension });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
changeModel: function(entityID, dataArray) {
|
||||||
|
// Change model of the entity
|
||||||
|
//print("Attempting to change model by: " + dataArray[0]);
|
||||||
|
var data = JSON.parse(dataArray[0]);
|
||||||
|
var index = data.index;
|
||||||
|
var entityProperties = Entities.getEntityProperties(this.entityID);
|
||||||
|
//print("------------- Changing the model from " + entityProperties.modelURL + " to: " + modelURLsArray[index]);
|
||||||
|
Entities.editEntity(this.entityID, { modelURL: modelURLsArray[index] }); // ????????
|
||||||
|
},
|
||||||
|
|
||||||
|
unload: function (entityID) {
|
||||||
|
Script.update.disconnect(update);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// entity scripts always need to return a newly constructed object of our type
|
||||||
|
return new DetectGrabbed();
|
||||||
|
})
|
919
hifi-content/alessandro/dev/JS/Misc/shopItemGrab.js
Normal file
919
hifi-content/alessandro/dev/JS/Misc/shopItemGrab.js
Normal file
|
@ -0,0 +1,919 @@
|
||||||
|
// handControllerGrab.js
|
||||||
|
// examples
|
||||||
|
//
|
||||||
|
// Created by Eric Levin on 9/2/15
|
||||||
|
// Additions by James B. Pollack @imgntn on 9/24/2015
|
||||||
|
// Additions By Seth Alves on 10/20/2015
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Grabs physically moveable entities with hydra-like controllers; it works for either near or far objects.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
/*global print, MyAvatar, Entities, AnimationCache, SoundCache, Scene, Camefra, Overlays, Audio, HMD, AvatarList, AvatarManager, Controller, UndoStack, Window, Account, GlobalServices, Script, ScriptDiscoveryService, LODManager, Menu, Vec3, Quat, AudioDevice, Paths, Clipboard, Settings, XMLHttpRequest, randFloat, randInt, pointInExtents, vec3equal, setEntityCustomData, getEntityCustomData */
|
||||||
|
|
||||||
|
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
Script.include(HIFI_PUBLIC_BUCKET + "scripts/libraries/utils.js");
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// add lines where the hand ray picking is happening
|
||||||
|
//
|
||||||
|
var WANT_DEBUG = false;
|
||||||
|
|
||||||
|
//
|
||||||
|
// these tune time-averaging and "on" value for analog trigger
|
||||||
|
//
|
||||||
|
|
||||||
|
var TRIGGER_SMOOTH_RATIO = 0.1; // 0.0 disables smoothing of trigger value
|
||||||
|
var TRIGGER_ON_VALUE = 0.4;
|
||||||
|
var TRIGGER_OFF_VALUE = 0.15;
|
||||||
|
//
|
||||||
|
// distant manipulation
|
||||||
|
//
|
||||||
|
|
||||||
|
var DISTANCE_HOLDING_RADIUS_FACTOR = 5; // multiplied by distance between hand and object
|
||||||
|
var DISTANCE_HOLDING_ACTION_TIMEFRAME = 0.1; // how quickly objects move to their new position
|
||||||
|
var DISTANCE_HOLDING_ROTATION_EXAGGERATION_FACTOR = 2.0; // object rotates this much more than hand did
|
||||||
|
|
||||||
|
var NO_INTERSECT_COLOR = {
|
||||||
|
red: 10,
|
||||||
|
green: 10,
|
||||||
|
blue: 255
|
||||||
|
}; // line color when pick misses
|
||||||
|
var INTERSECT_COLOR = {
|
||||||
|
red: 250,
|
||||||
|
green: 10,
|
||||||
|
blue: 10
|
||||||
|
}; // line color when pick hits
|
||||||
|
var LINE_ENTITY_DIMENSIONS = {
|
||||||
|
x: 1000,
|
||||||
|
y: 1000,
|
||||||
|
z: 1000
|
||||||
|
};
|
||||||
|
var LINE_LENGTH = 500;
|
||||||
|
var PICK_MAX_DISTANCE = 500; // max length of pick-ray
|
||||||
|
|
||||||
|
//
|
||||||
|
// near grabbing
|
||||||
|
//
|
||||||
|
|
||||||
|
var GRAB_RADIUS = 0.03; // if the ray misses but an object is this close, it will still be selected
|
||||||
|
var NEAR_GRABBING_ACTION_TIMEFRAME = 0.05; // how quickly objects move to their new position
|
||||||
|
var NEAR_GRABBING_VELOCITY_SMOOTH_RATIO = 1.0; // adjust time-averaging of held object's velocity. 1.0 to disable.
|
||||||
|
var NEAR_PICK_MAX_DISTANCE = 0.3; // max length of pick-ray for close grabbing to be selected
|
||||||
|
var RELEASE_VELOCITY_MULTIPLIER = 1.5; // affects throwing things
|
||||||
|
var PICK_BACKOFF_DISTANCE = 0.2; // helps when hand is intersecting the grabble object
|
||||||
|
var NEAR_GRABBING_KINEMATIC = true; // force objects to be kinematic when near-grabbed
|
||||||
|
|
||||||
|
//
|
||||||
|
// equip
|
||||||
|
//
|
||||||
|
|
||||||
|
var EQUIP_SPRING_SHUTOFF_DISTANCE = 0.05;
|
||||||
|
var EQUIP_SPRING_TIMEFRAME = 0.4; // how quickly objects move to their new position
|
||||||
|
|
||||||
|
//
|
||||||
|
// other constants
|
||||||
|
//
|
||||||
|
|
||||||
|
var RIGHT_HAND = 1;
|
||||||
|
var LEFT_HAND = 0;
|
||||||
|
|
||||||
|
var ZERO_VEC = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
};
|
||||||
|
|
||||||
|
var NULL_ACTION_ID = "{00000000-0000-0000-000000000000}";
|
||||||
|
var MSEC_PER_SEC = 1000.0;
|
||||||
|
|
||||||
|
// these control how long an abandoned pointer line or action will hang around
|
||||||
|
var LIFETIME = 10;
|
||||||
|
var ACTION_TTL = 15; // seconds
|
||||||
|
var ACTION_TTL_REFRESH = 5;
|
||||||
|
var PICKS_PER_SECOND_PER_HAND = 5;
|
||||||
|
var MSECS_PER_SEC = 1000.0;
|
||||||
|
var GRABBABLE_PROPERTIES = [
|
||||||
|
"position",
|
||||||
|
"rotation",
|
||||||
|
"gravity",
|
||||||
|
"ignoreForCollisions",
|
||||||
|
"collisionsWillMove",
|
||||||
|
"locked",
|
||||||
|
"name"
|
||||||
|
];
|
||||||
|
|
||||||
|
var GRABBABLE_DATA_KEY = "grabbableKey"; // shared with grab.js
|
||||||
|
var GRAB_USER_DATA_KEY = "grabKey"; // shared with grab.js
|
||||||
|
|
||||||
|
var DEFAULT_GRABBABLE_DATA = {
|
||||||
|
grabbable: true,
|
||||||
|
invertSolidWhileHeld: false
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// states for the state machine
|
||||||
|
var STATE_OFF = 0;
|
||||||
|
var STATE_SEARCHING = 1;
|
||||||
|
var STATE_NEAR_GRABBING = 4;
|
||||||
|
var STATE_CONTINUE_NEAR_GRABBING = 5;
|
||||||
|
var STATE_NEAR_TRIGGER = 6;
|
||||||
|
var STATE_CONTINUE_NEAR_TRIGGER = 7;
|
||||||
|
var STATE_FAR_TRIGGER = 8;
|
||||||
|
var STATE_CONTINUE_FAR_TRIGGER = 9;
|
||||||
|
var STATE_RELEASE = 10;
|
||||||
|
var STATE_EQUIP_SEARCHING = 11;
|
||||||
|
var STATE_EQUIP = 12
|
||||||
|
var STATE_CONTINUE_EQUIP_BD = 13; // equip while bumper is still held down
|
||||||
|
var STATE_CONTINUE_EQUIP = 14;
|
||||||
|
var STATE_EQUIP_SPRING = 16;
|
||||||
|
|
||||||
|
|
||||||
|
function stateToName(state) {
|
||||||
|
switch (state) {
|
||||||
|
case STATE_OFF:
|
||||||
|
return "off";
|
||||||
|
case STATE_SEARCHING:
|
||||||
|
return "searching";
|
||||||
|
case STATE_NEAR_GRABBING:
|
||||||
|
return "near_grabbing";
|
||||||
|
case STATE_CONTINUE_NEAR_GRABBING:
|
||||||
|
return "continue_near_grabbing";
|
||||||
|
case STATE_NEAR_TRIGGER:
|
||||||
|
return "near_trigger";
|
||||||
|
case STATE_CONTINUE_NEAR_TRIGGER:
|
||||||
|
return "continue_near_trigger";
|
||||||
|
case STATE_FAR_TRIGGER:
|
||||||
|
return "far_trigger";
|
||||||
|
case STATE_CONTINUE_FAR_TRIGGER:
|
||||||
|
return "continue_far_trigger";
|
||||||
|
case STATE_RELEASE:
|
||||||
|
return "release";
|
||||||
|
case STATE_EQUIP_SEARCHING:
|
||||||
|
return "equip_searching";
|
||||||
|
case STATE_EQUIP:
|
||||||
|
return "equip";
|
||||||
|
case STATE_CONTINUE_EQUIP_BD:
|
||||||
|
return "continue_equip_bd";
|
||||||
|
case STATE_CONTINUE_EQUIP:
|
||||||
|
return "continue_equip";
|
||||||
|
case STATE_EQUIP_SPRING:
|
||||||
|
return "state_equip_spring";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function MyController(hand) {
|
||||||
|
this.hand = hand;
|
||||||
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
this.getHandPosition = MyAvatar.getRightPalmPosition;
|
||||||
|
this.getHandRotation = MyAvatar.getRightPalmRotation;
|
||||||
|
} else {
|
||||||
|
this.getHandPosition = MyAvatar.getLeftPalmPosition;
|
||||||
|
this.getHandRotation = MyAvatar.getLeftPalmRotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
var SPATIAL_CONTROLLERS_PER_PALM = 2;
|
||||||
|
var TIP_CONTROLLER_OFFSET = 1;
|
||||||
|
this.palm = SPATIAL_CONTROLLERS_PER_PALM * hand;
|
||||||
|
this.tip = SPATIAL_CONTROLLERS_PER_PALM * hand + TIP_CONTROLLER_OFFSET;
|
||||||
|
|
||||||
|
this.actionID = null; // action this script created...
|
||||||
|
this.grabbedEntity = null; // on this entity.
|
||||||
|
this.state = STATE_OFF;
|
||||||
|
this.pointer = null; // entity-id of line object
|
||||||
|
this.triggerValue = 0; // rolling average of trigger value
|
||||||
|
this.rawTriggerValue = 0;
|
||||||
|
|
||||||
|
this.offsetPosition = {
|
||||||
|
x: 0.0,
|
||||||
|
y: 0.0,
|
||||||
|
z: 0.0
|
||||||
|
};
|
||||||
|
this.offsetRotation = {
|
||||||
|
x: 0.0,
|
||||||
|
y: 0.0,
|
||||||
|
z: 0.0,
|
||||||
|
w: 1.0
|
||||||
|
};
|
||||||
|
|
||||||
|
var _this = this;
|
||||||
|
|
||||||
|
this.update = function() {
|
||||||
|
|
||||||
|
this.updateSmoothedTrigger();
|
||||||
|
|
||||||
|
switch (this.state) {
|
||||||
|
case STATE_OFF:
|
||||||
|
this.off();
|
||||||
|
this.touchTest();
|
||||||
|
break;
|
||||||
|
case STATE_SEARCHING:
|
||||||
|
this.search();
|
||||||
|
break;
|
||||||
|
case STATE_EQUIP_SEARCHING:
|
||||||
|
this.search();
|
||||||
|
break;
|
||||||
|
case STATE_NEAR_GRABBING:
|
||||||
|
case STATE_EQUIP:
|
||||||
|
this.nearGrabbing();
|
||||||
|
break;
|
||||||
|
case STATE_EQUIP_SPRING:
|
||||||
|
this.pullTowardEquipPosition()
|
||||||
|
break;
|
||||||
|
case STATE_CONTINUE_NEAR_GRABBING:
|
||||||
|
case STATE_CONTINUE_EQUIP_BD:
|
||||||
|
case STATE_CONTINUE_EQUIP:
|
||||||
|
this.continueNearGrabbing();
|
||||||
|
break;
|
||||||
|
case STATE_NEAR_TRIGGER:
|
||||||
|
this.nearTrigger();
|
||||||
|
break;
|
||||||
|
case STATE_CONTINUE_NEAR_TRIGGER:
|
||||||
|
this.continueNearTrigger();
|
||||||
|
break;
|
||||||
|
case STATE_FAR_TRIGGER:
|
||||||
|
this.farTrigger();
|
||||||
|
break;
|
||||||
|
case STATE_CONTINUE_FAR_TRIGGER:
|
||||||
|
this.continueFarTrigger();
|
||||||
|
break;
|
||||||
|
case STATE_RELEASE:
|
||||||
|
this.release();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.setState = function(newState) {
|
||||||
|
if (WANT_DEBUG) {
|
||||||
|
print("STATE: " + stateToName(this.state) + " --> " + stateToName(newState) + ", hand: " + this.hand);
|
||||||
|
}
|
||||||
|
this.state = newState;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.debugLine = function(closePoint, farPoint, color) {
|
||||||
|
Entities.addEntity({
|
||||||
|
type: "Line",
|
||||||
|
name: "Grab Debug Entity",
|
||||||
|
dimensions: LINE_ENTITY_DIMENSIONS,
|
||||||
|
visible: true,
|
||||||
|
position: closePoint,
|
||||||
|
linePoints: [ZERO_VEC, farPoint],
|
||||||
|
color: color,
|
||||||
|
lifetime: 0.1,
|
||||||
|
collisionsWillMove: false,
|
||||||
|
ignoreForCollisions: true,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
grabbableKey: {
|
||||||
|
grabbable: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lineOn = function(closePoint, farPoint, color) {
|
||||||
|
// draw a line
|
||||||
|
if (this.pointer === null) {
|
||||||
|
this.pointer = Entities.addEntity({
|
||||||
|
type: "Line",
|
||||||
|
name: "grab pointer",
|
||||||
|
dimensions: LINE_ENTITY_DIMENSIONS,
|
||||||
|
visible: false,
|
||||||
|
position: closePoint,
|
||||||
|
linePoints: [ZERO_VEC, farPoint],
|
||||||
|
color: color,
|
||||||
|
lifetime: LIFETIME,
|
||||||
|
collisionsWillMove: false,
|
||||||
|
ignoreForCollisions: true,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
grabbableKey: {
|
||||||
|
grabbable: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var age = Entities.getEntityProperties(this.pointer, "age").age;
|
||||||
|
this.pointer = Entities.editEntity(this.pointer, {
|
||||||
|
position: closePoint,
|
||||||
|
linePoints: [ZERO_VEC, farPoint],
|
||||||
|
color: color,
|
||||||
|
lifetime: age + LIFETIME
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.lineOff = function() {
|
||||||
|
if (this.pointer !== null) {
|
||||||
|
Entities.deleteEntity(this.pointer);
|
||||||
|
}
|
||||||
|
this.pointer = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.triggerPress = function(value) {
|
||||||
|
_this.rawTriggerValue = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.updateSmoothedTrigger = function() {
|
||||||
|
var triggerValue = this.rawTriggerValue;
|
||||||
|
// smooth out trigger value
|
||||||
|
this.triggerValue = (this.triggerValue * TRIGGER_SMOOTH_RATIO) +
|
||||||
|
(triggerValue * (1.0 - TRIGGER_SMOOTH_RATIO));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.triggerSmoothedSqueezed = function() {
|
||||||
|
return this.triggerValue > TRIGGER_ON_VALUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.triggerSmoothedReleased = function() {
|
||||||
|
return this.triggerValue < TRIGGER_OFF_VALUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.triggerSqueezed = function() {
|
||||||
|
var triggerValue = this.rawTriggerValue;
|
||||||
|
return triggerValue > TRIGGER_ON_VALUE;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.off = function() {
|
||||||
|
if (this.triggerSmoothedSqueezed()) {
|
||||||
|
this.lastPickTime = 0;
|
||||||
|
this.setState(STATE_SEARCHING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.search = function() {
|
||||||
|
this.grabbedEntity = null;
|
||||||
|
|
||||||
|
if (this.state == STATE_SEARCHING && this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the trigger is being pressed, do a ray test
|
||||||
|
var handPosition = this.getHandPosition();
|
||||||
|
var distantPickRay = {
|
||||||
|
origin: handPosition,
|
||||||
|
direction: Quat.getUp(this.getHandRotation()),
|
||||||
|
length: PICK_MAX_DISTANCE
|
||||||
|
};
|
||||||
|
|
||||||
|
// don't pick 60x per second.
|
||||||
|
var pickRays = [];
|
||||||
|
var now = Date.now();
|
||||||
|
if (now - this.lastPickTime > MSECS_PER_SEC / PICKS_PER_SECOND_PER_HAND) {
|
||||||
|
pickRays = [distantPickRay];
|
||||||
|
this.lastPickTime = now;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var index = 0; index < pickRays.length; ++index) {
|
||||||
|
var pickRay = pickRays[index];
|
||||||
|
var directionNormalized = Vec3.normalize(pickRay.direction);
|
||||||
|
var directionBacked = Vec3.multiply(directionNormalized, PICK_BACKOFF_DISTANCE);
|
||||||
|
var pickRayBacked = {
|
||||||
|
origin: Vec3.subtract(pickRay.origin, directionBacked),
|
||||||
|
direction: pickRay.direction
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
var intersection = Entities.findRayIntersection(pickRayBacked, true);
|
||||||
|
|
||||||
|
if (intersection.intersects) {
|
||||||
|
// the ray is intersecting something we can move.
|
||||||
|
var intersectionDistance = Vec3.distance(pickRay.origin, intersection.intersection);
|
||||||
|
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, DEFAULT_GRABBABLE_DATA);
|
||||||
|
|
||||||
|
if (intersection.properties.name == "Grab Debug Entity") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof grabbableData.grabbable !== 'undefined' && !grabbableData.grabbable) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (intersectionDistance > pickRay.length) {
|
||||||
|
// too far away for this ray.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (intersectionDistance <= NEAR_PICK_MAX_DISTANCE) {
|
||||||
|
// the hand is very close to the intersected object. go into close-grabbing mode.
|
||||||
|
if (grabbableData.wantsTrigger) {
|
||||||
|
print("--------------- grabbable data -> STATE_NEAR_TRIGGER");
|
||||||
|
this.grabbedEntity = intersection.entityID;
|
||||||
|
this.setState(STATE_NEAR_TRIGGER);
|
||||||
|
return;
|
||||||
|
} else if (!intersection.properties.locked) {
|
||||||
|
var ownerObj = getEntityCustomData('ownerKey', intersection.entityID, null);
|
||||||
|
print("----------------------- ownerID: " + ((ownerObj == null) ? ownerObj : ownerObj.ownerID));
|
||||||
|
|
||||||
|
if (ownerObj == null || ownerObj.ownerID === MyAvatar.sessionUUID) {
|
||||||
|
this.grabbedEntity = intersection.entityID;
|
||||||
|
if (this.state == STATE_SEARCHING) {
|
||||||
|
this.setState(STATE_NEAR_GRABBING);
|
||||||
|
} else { // equipping
|
||||||
|
if (typeof grabbableData.spatialKey !== 'undefined') {
|
||||||
|
this.setState(STATE_EQUIP_SPRING);
|
||||||
|
} else {
|
||||||
|
this.setState(STATE_EQUIP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lineOn(distantPickRay.origin, Vec3.multiply(distantPickRay.direction, LINE_LENGTH), NO_INTERSECT_COLOR);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.nearGrabbing = function() {
|
||||||
|
var now = Date.now();
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||||
|
|
||||||
|
if (this.state == STATE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "releaseGrab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lineOff();
|
||||||
|
|
||||||
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
||||||
|
this.activateEntity(this.grabbedEntity, grabbedProperties);
|
||||||
|
if (grabbedProperties.collisionsWillMove && NEAR_GRABBING_KINEMATIC) {
|
||||||
|
Entities.editEntity(this.grabbedEntity, {
|
||||||
|
collisionsWillMove: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var handRotation = this.getHandRotation();
|
||||||
|
var handPosition = this.getHandPosition();
|
||||||
|
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||||
|
|
||||||
|
if (this.state != STATE_NEAR_GRABBING && grabbableData.spatialKey) {
|
||||||
|
// if an object is "equipped" and has a spatialKey, use it.
|
||||||
|
if (grabbableData.spatialKey.relativePosition) {
|
||||||
|
this.offsetPosition = grabbableData.spatialKey.relativePosition;
|
||||||
|
}
|
||||||
|
if (grabbableData.spatialKey.relativeRotation) {
|
||||||
|
this.offsetRotation = grabbableData.spatialKey.relativeRotation;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var objectRotation = grabbedProperties.rotation;
|
||||||
|
this.offsetRotation = Quat.multiply(Quat.inverse(handRotation), objectRotation);
|
||||||
|
|
||||||
|
var currentObjectPosition = grabbedProperties.position;
|
||||||
|
var offset = Vec3.subtract(currentObjectPosition, handPosition);
|
||||||
|
this.offsetPosition = Vec3.multiplyQbyV(Quat.inverse(Quat.multiply(handRotation, this.offsetRotation)), offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.actionID = NULL_ACTION_ID;
|
||||||
|
this.actionID = Entities.addAction("hold", this.grabbedEntity, {
|
||||||
|
hand: this.hand === RIGHT_HAND ? "right" : "left",
|
||||||
|
timeScale: NEAR_GRABBING_ACTION_TIMEFRAME,
|
||||||
|
relativePosition: this.offsetPosition,
|
||||||
|
relativeRotation: this.offsetRotation,
|
||||||
|
ttl: ACTION_TTL,
|
||||||
|
kinematic: NEAR_GRABBING_KINEMATIC,
|
||||||
|
kinematicSetVelocity: true
|
||||||
|
});
|
||||||
|
if (this.actionID === NULL_ACTION_ID) {
|
||||||
|
this.actionID = null;
|
||||||
|
} else {
|
||||||
|
this.actionTimeout = now + (ACTION_TTL * MSEC_PER_SEC);
|
||||||
|
if (this.state == STATE_NEAR_GRABBING) {
|
||||||
|
this.setState(STATE_CONTINUE_NEAR_GRABBING);
|
||||||
|
} else {
|
||||||
|
// equipping
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "startEquip", [JSON.stringify(this.hand)]);
|
||||||
|
this.startHandGrasp();
|
||||||
|
this.setState(STATE_CONTINUE_EQUIP_BD);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setRightHand");
|
||||||
|
} else {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setLeftHand");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setHand", [this.hand]);
|
||||||
|
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "startNearGrab");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
this.currentHandControllerTipPosition =
|
||||||
|
(this.hand === RIGHT_HAND) ? MyAvatar.rightHandTipPosition : MyAvatar.leftHandTipPosition;
|
||||||
|
|
||||||
|
this.currentObjectTime = Date.now();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.continueNearGrabbing = function() {
|
||||||
|
if (this.state == STATE_CONTINUE_NEAR_GRABBING && this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "releaseGrab");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep track of the fingertip velocity to impart when we release the object.
|
||||||
|
// Note that the idea of using a constant 'tip' velocity regardless of the
|
||||||
|
// object's actual held offset is an idea intended to make it easier to throw things:
|
||||||
|
// Because we might catch something or transfer it between hands without a good idea
|
||||||
|
// of it's actual offset, let's try imparting a velocity which is at a fixed radius
|
||||||
|
// from the palm.
|
||||||
|
|
||||||
|
var handControllerPosition = (this.hand === RIGHT_HAND) ? MyAvatar.rightHandPosition : MyAvatar.leftHandPosition;
|
||||||
|
var now = Date.now();
|
||||||
|
|
||||||
|
var deltaPosition = Vec3.subtract(handControllerPosition, this.currentHandControllerTipPosition); // meters
|
||||||
|
var deltaTime = (now - this.currentObjectTime) / MSEC_PER_SEC; // convert to seconds
|
||||||
|
|
||||||
|
this.currentHandControllerTipPosition = handControllerPosition;
|
||||||
|
this.currentObjectTime = now;
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "continueNearGrab");
|
||||||
|
|
||||||
|
if (this.state === STATE_CONTINUE_EQUIP_BD) {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "continueEquip");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.actionTimeout - now < ACTION_TTL_REFRESH * MSEC_PER_SEC) {
|
||||||
|
// if less than a 5 seconds left, refresh the actions ttl
|
||||||
|
Entities.updateAction(this.grabbedEntity, this.actionID, {
|
||||||
|
hand: this.hand === RIGHT_HAND ? "right" : "left",
|
||||||
|
timeScale: NEAR_GRABBING_ACTION_TIMEFRAME,
|
||||||
|
relativePosition: this.offsetPosition,
|
||||||
|
relativeRotation: this.offsetRotation,
|
||||||
|
ttl: ACTION_TTL,
|
||||||
|
kinematic: NEAR_GRABBING_KINEMATIC,
|
||||||
|
kinematicSetVelocity: true
|
||||||
|
});
|
||||||
|
this.actionTimeout = now + (ACTION_TTL * MSEC_PER_SEC);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.pullTowardEquipPosition = function() {
|
||||||
|
this.lineOff();
|
||||||
|
|
||||||
|
var grabbedProperties = Entities.getEntityProperties(this.grabbedEntity, GRABBABLE_PROPERTIES);
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, this.grabbedEntity, DEFAULT_GRABBABLE_DATA);
|
||||||
|
|
||||||
|
// use a spring to pull the object to where it will be when equipped
|
||||||
|
var relativeRotation = {
|
||||||
|
x: 0.0,
|
||||||
|
y: 0.0,
|
||||||
|
z: 0.0,
|
||||||
|
w: 1.0
|
||||||
|
};
|
||||||
|
var relativePosition = {
|
||||||
|
x: 0.0,
|
||||||
|
y: 0.0,
|
||||||
|
z: 0.0
|
||||||
|
};
|
||||||
|
if (grabbableData.spatialKey.relativePosition) {
|
||||||
|
relativePosition = grabbableData.spatialKey.relativePosition;
|
||||||
|
}
|
||||||
|
if (grabbableData.spatialKey.relativeRotation) {
|
||||||
|
relativeRotation = grabbableData.spatialKey.relativeRotation;
|
||||||
|
}
|
||||||
|
var handRotation = this.getHandRotation();
|
||||||
|
var handPosition = this.getHandPosition();
|
||||||
|
var targetRotation = Quat.multiply(handRotation, relativeRotation);
|
||||||
|
var offset = Vec3.multiplyQbyV(targetRotation, relativePosition);
|
||||||
|
var targetPosition = Vec3.sum(handPosition, offset);
|
||||||
|
|
||||||
|
if (typeof this.equipSpringID === 'undefined' ||
|
||||||
|
this.equipSpringID === null ||
|
||||||
|
this.equipSpringID === NULL_ACTION_ID) {
|
||||||
|
this.equipSpringID = Entities.addAction("spring", this.grabbedEntity, {
|
||||||
|
targetPosition: targetPosition,
|
||||||
|
linearTimeScale: EQUIP_SPRING_TIMEFRAME,
|
||||||
|
targetRotation: targetRotation,
|
||||||
|
angularTimeScale: EQUIP_SPRING_TIMEFRAME,
|
||||||
|
ttl: ACTION_TTL
|
||||||
|
});
|
||||||
|
if (this.equipSpringID === NULL_ACTION_ID) {
|
||||||
|
this.equipSpringID = null;
|
||||||
|
this.setState(STATE_OFF);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Entities.updateAction(this.grabbedEntity, this.equipSpringID, {
|
||||||
|
targetPosition: targetPosition,
|
||||||
|
linearTimeScale: EQUIP_SPRING_TIMEFRAME,
|
||||||
|
targetRotation: targetRotation,
|
||||||
|
angularTimeScale: EQUIP_SPRING_TIMEFRAME,
|
||||||
|
ttl: ACTION_TTL
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Vec3.distance(grabbedProperties.position, targetPosition) < EQUIP_SPRING_SHUTOFF_DISTANCE) {
|
||||||
|
Entities.deleteAction(this.grabbedEntity, this.equipSpringID);
|
||||||
|
this.equipSpringID = null;
|
||||||
|
this.setState(STATE_EQUIP);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.nearTrigger = function() {
|
||||||
|
if (this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "stopNearTrigger");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setRightHand");
|
||||||
|
} else {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setLeftHand");
|
||||||
|
}
|
||||||
|
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setHand", [this.hand]);
|
||||||
|
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "startNearTrigger");
|
||||||
|
this.setState(STATE_CONTINUE_NEAR_TRIGGER);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.farTrigger = function() {
|
||||||
|
if (this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "stopFarTrigger");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setRightHand");
|
||||||
|
} else {
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setLeftHand");
|
||||||
|
}
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "setHand", [this.hand]);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "startFarTrigger");
|
||||||
|
this.setState(STATE_CONTINUE_FAR_TRIGGER);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.continueNearTrigger = function() {
|
||||||
|
if (this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "stopNearTrigger");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "continueNearTrigger");
|
||||||
|
};
|
||||||
|
|
||||||
|
this.continueFarTrigger = function() {
|
||||||
|
if (this.triggerSmoothedReleased()) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "stopNearTrigger");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var handPosition = this.getHandPosition();
|
||||||
|
var pickRay = {
|
||||||
|
origin: handPosition,
|
||||||
|
direction: Quat.getUp(this.getHandRotation())
|
||||||
|
};
|
||||||
|
|
||||||
|
var now = Date.now();
|
||||||
|
if (now - this.lastPickTime > MSECS_PER_SEC / PICKS_PER_SECOND_PER_HAND) {
|
||||||
|
var intersection = Entities.findRayIntersection(pickRay, true);
|
||||||
|
this.lastPickTime = now;
|
||||||
|
if (intersection.entityID != this.grabbedEntity) {
|
||||||
|
this.setState(STATE_RELEASE);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "stopFarTrigger");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lineOn(pickRay.origin, Vec3.multiply(pickRay.direction, LINE_LENGTH), NO_INTERSECT_COLOR);
|
||||||
|
Entities.callEntityMethod(this.grabbedEntity, "continueFarTrigger");
|
||||||
|
};
|
||||||
|
|
||||||
|
_this.allTouchedIDs = {};
|
||||||
|
this.touchTest = function() {
|
||||||
|
var maxDistance = 0.05;
|
||||||
|
var leftHandPosition = MyAvatar.getLeftPalmPosition();
|
||||||
|
var rightHandPosition = MyAvatar.getRightPalmPosition();
|
||||||
|
var leftEntities = Entities.findEntities(leftHandPosition, maxDistance);
|
||||||
|
var rightEntities = Entities.findEntities(rightHandPosition, maxDistance);
|
||||||
|
var ids = [];
|
||||||
|
|
||||||
|
if (leftEntities.length !== 0) {
|
||||||
|
leftEntities.forEach(function(entity) {
|
||||||
|
ids.push(entity);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rightEntities.length !== 0) {
|
||||||
|
rightEntities.forEach(function(entity) {
|
||||||
|
ids.push(entity);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ids.forEach(function(id) {
|
||||||
|
|
||||||
|
var props = Entities.getEntityProperties(id, ["boundingBox", "name"]);
|
||||||
|
if (props.name === 'pointer') {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
var entityMinPoint = props.boundingBox.brn;
|
||||||
|
var entityMaxPoint = props.boundingBox.tfl;
|
||||||
|
var leftIsTouching = pointInExtents(leftHandPosition, entityMinPoint, entityMaxPoint);
|
||||||
|
var rightIsTouching = pointInExtents(rightHandPosition, entityMinPoint, entityMaxPoint);
|
||||||
|
|
||||||
|
if ((leftIsTouching || rightIsTouching) && _this.allTouchedIDs[id] === undefined) {
|
||||||
|
// we haven't been touched before, but either right or left is touching us now
|
||||||
|
_this.allTouchedIDs[id] = true;
|
||||||
|
_this.startTouch(id);
|
||||||
|
} else if ((leftIsTouching || rightIsTouching) && _this.allTouchedIDs[id]) {
|
||||||
|
// we have been touched before and are still being touched
|
||||||
|
// continue touch
|
||||||
|
_this.continueTouch(id);
|
||||||
|
} else if (_this.allTouchedIDs[id]) {
|
||||||
|
delete _this.allTouchedIDs[id];
|
||||||
|
_this.stopTouch(id);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//we are in another state
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
this.startTouch = function(entityID) {
|
||||||
|
Entities.callEntityMethod(entityID, "startTouch");
|
||||||
|
};
|
||||||
|
|
||||||
|
this.continueTouch = function(entityID) {
|
||||||
|
Entities.callEntityMethod(entityID, "continueTouch");
|
||||||
|
};
|
||||||
|
|
||||||
|
this.stopTouch = function(entityID) {
|
||||||
|
Entities.callEntityMethod(entityID, "stopTouch");
|
||||||
|
};
|
||||||
|
|
||||||
|
this.release = function() {
|
||||||
|
|
||||||
|
this.lineOff();
|
||||||
|
|
||||||
|
if (this.grabbedEntity !== null) {
|
||||||
|
if (this.actionID !== null) {
|
||||||
|
Entities.deleteAction(this.grabbedEntity, this.actionID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.deactivateEntity(this.grabbedEntity);
|
||||||
|
|
||||||
|
this.grabbedEntity = null;
|
||||||
|
this.actionID = null;
|
||||||
|
this.setState(STATE_OFF);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.cleanup = function() {
|
||||||
|
this.release();
|
||||||
|
this.endHandGrasp();
|
||||||
|
};
|
||||||
|
|
||||||
|
this.activateEntity = function(entityID, grabbedProperties) {
|
||||||
|
var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, entityID, DEFAULT_GRABBABLE_DATA);
|
||||||
|
var invertSolidWhileHeld = grabbableData["invertSolidWhileHeld"];
|
||||||
|
var data = getEntityCustomData(GRAB_USER_DATA_KEY, entityID, {});
|
||||||
|
data["activated"] = true;
|
||||||
|
data["avatarId"] = MyAvatar.sessionUUID;
|
||||||
|
data["refCount"] = data["refCount"] ? data["refCount"] + 1 : 1;
|
||||||
|
// zero gravity and set ignoreForCollisions in a way that lets us put them back, after all grabs are done
|
||||||
|
if (data["refCount"] == 1) {
|
||||||
|
data["gravity"] = grabbedProperties.gravity;
|
||||||
|
data["ignoreForCollisions"] = grabbedProperties.ignoreForCollisions;
|
||||||
|
data["collisionsWillMove"] = grabbedProperties.collisionsWillMove;
|
||||||
|
var whileHeldProperties = {
|
||||||
|
gravity: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (invertSolidWhileHeld) {
|
||||||
|
whileHeldProperties["ignoreForCollisions"] = !grabbedProperties.ignoreForCollisions;
|
||||||
|
}
|
||||||
|
Entities.editEntity(entityID, whileHeldProperties);
|
||||||
|
}
|
||||||
|
|
||||||
|
setEntityCustomData(GRAB_USER_DATA_KEY, entityID, data);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.deactivateEntity = function(entityID) {
|
||||||
|
var data = getEntityCustomData(GRAB_USER_DATA_KEY, entityID, {});
|
||||||
|
if (data && data["refCount"]) {
|
||||||
|
data["refCount"] = data["refCount"] - 1;
|
||||||
|
if (data["refCount"] < 1) {
|
||||||
|
Entities.editEntity(entityID, {
|
||||||
|
gravity: data["gravity"],
|
||||||
|
ignoreForCollisions: data["ignoreForCollisions"],
|
||||||
|
collisionsWillMove: data["collisionsWillMove"]
|
||||||
|
});
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
data = null;
|
||||||
|
}
|
||||||
|
setEntityCustomData(GRAB_USER_DATA_KEY, entityID, data);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//this is our handler, where we do the actual work of changing animation settings
|
||||||
|
this.graspHand = function(animationProperties) {
|
||||||
|
var result = {};
|
||||||
|
//full alpha on overlay for this hand
|
||||||
|
//set grab to true
|
||||||
|
//set idle to false
|
||||||
|
//full alpha on the blend btw open and grab
|
||||||
|
if (_this.hand === RIGHT_HAND) {
|
||||||
|
result['rightHandOverlayAlpha'] = 1.0;
|
||||||
|
result['isRightHandGrab'] = true;
|
||||||
|
result['isRightHandIdle'] = false;
|
||||||
|
result['rightHandGrabBlend'] = 1.0;
|
||||||
|
} else if (_this.hand === LEFT_HAND) {
|
||||||
|
result['leftHandOverlayAlpha'] = 1.0;
|
||||||
|
result['isLeftHandGrab'] = true;
|
||||||
|
result['isLeftHandIdle'] = false;
|
||||||
|
result['leftHandGrabBlend'] = 1.0;
|
||||||
|
}
|
||||||
|
//return an object with our updated settings
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.graspHandler = null
|
||||||
|
this.startHandGrasp = function() {
|
||||||
|
if (this.hand === RIGHT_HAND) {
|
||||||
|
this.graspHandler = MyAvatar.addAnimationStateHandler(this.graspHand, ['isRightHandGrab']);
|
||||||
|
} else if (this.hand === LEFT_HAND) {
|
||||||
|
this.graspHandler = MyAvatar.addAnimationStateHandler(this.graspHand, ['isLeftHandGrab']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.endHandGrasp = function() {
|
||||||
|
// Tell the animation system we don't need any more callbacks.
|
||||||
|
MyAvatar.removeAnimationStateHandler(this.graspHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var rightController = new MyController(RIGHT_HAND);
|
||||||
|
var leftController = new MyController(LEFT_HAND);
|
||||||
|
|
||||||
|
var MAPPING_NAME = "com.highfidelity.handControllerGrab";
|
||||||
|
|
||||||
|
var mapping = Controller.newMapping(MAPPING_NAME);
|
||||||
|
mapping.from([Controller.Standard.RT]).peek().to(rightController.triggerPress);
|
||||||
|
mapping.from([Controller.Standard.LT]).peek().to(leftController.triggerPress);
|
||||||
|
|
||||||
|
Controller.enableMapping(MAPPING_NAME);
|
||||||
|
|
||||||
|
var handToDisable = 'none';
|
||||||
|
|
||||||
|
function update() {
|
||||||
|
if (handToDisable !== LEFT_HAND) {
|
||||||
|
leftController.update();
|
||||||
|
}
|
||||||
|
if (handToDisable !== RIGHT_HAND) {
|
||||||
|
rightController.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Messages.subscribe('Hifi-Hand-Disabler');
|
||||||
|
|
||||||
|
handleHandDisablerMessages = function(channel, message, sender) {
|
||||||
|
|
||||||
|
if (sender === MyAvatar.sessionUUID) {
|
||||||
|
handToDisable = message;
|
||||||
|
if (message === 'left') {
|
||||||
|
handToDisable = LEFT_HAND;
|
||||||
|
}
|
||||||
|
if (message === 'right') {
|
||||||
|
handToDisable = RIGHT_HAND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Messages.messageReceived.connect(handleHandDisablerMessages);
|
||||||
|
|
||||||
|
function cleanup() {
|
||||||
|
rightController.cleanup();
|
||||||
|
leftController.cleanup();
|
||||||
|
Controller.disableMapping(MAPPING_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
Script.update.connect(update);
|
45
hifi-content/alessandro/dev/JS/Misc/shopShelfEntityScript.js
Normal file
45
hifi-content/alessandro/dev/JS/Misc/shopShelfEntityScript.js
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
//
|
||||||
|
// detectGrabExample.js
|
||||||
|
// examples/entityScripts
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 9/3/15.
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// This is an example of an entity script which when assigned to an entity, will detect when the entity is being grabbed by the hydraGrab script
|
||||||
|
//
|
||||||
|
// 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 hand;
|
||||||
|
var onShelf = true;
|
||||||
|
|
||||||
|
// this is the "constructor" for the entity as a JS object we don't do much here, but we do want to remember
|
||||||
|
// our this object, so we can access it in cases where we're called without a this (like in the case of various global signals)
|
||||||
|
Shelf = function() {
|
||||||
|
_this = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
Shelf.prototype = {
|
||||||
|
|
||||||
|
// preload() will be called when the entity has become visible (or known) to the interface
|
||||||
|
// it gives us a chance to set our local JavaScript object up. In this case it means:
|
||||||
|
// * remembering our entityID, so we can access it in cases where we're called without an entityID
|
||||||
|
// * connecting to the update signal so we can check our grabbed state
|
||||||
|
preload: function(entityID) {
|
||||||
|
this.entityID = entityID;
|
||||||
|
},
|
||||||
|
|
||||||
|
doSomething: function (entityID, dataArray) {
|
||||||
|
var data = JSON.parse(dataArray[0]);
|
||||||
|
print("item ID: " + data.id);
|
||||||
|
Entities.deleteEntity(data.id);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
// entity scripts always need to return a newly constructed object of our type
|
||||||
|
return new Shelf();
|
||||||
|
})
|
412
hifi-content/alessandro/dev/JS/libraries/overlayManager.js
Normal file
412
hifi-content/alessandro/dev/JS/libraries/overlayManager.js
Normal file
|
@ -0,0 +1,412 @@
|
||||||
|
//
|
||||||
|
// overlayManager.js
|
||||||
|
// examples/libraries
|
||||||
|
//
|
||||||
|
// Created by Zander Otavka on 7/24/15
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// Manage overlays with object oriented goodness, instead of ugly `Overlays.h` methods.
|
||||||
|
// Instead of:
|
||||||
|
//
|
||||||
|
// var billboard = Overlays.addOverlay("image3d", { visible: false });
|
||||||
|
// ...
|
||||||
|
// Overlays.editOverlay(billboard, { visible: true });
|
||||||
|
// ...
|
||||||
|
// Overlays.deleteOverlay(billboard);
|
||||||
|
//
|
||||||
|
// You can now do:
|
||||||
|
//
|
||||||
|
// var billboard = new Image3DOverlay({ visible: false });
|
||||||
|
// ...
|
||||||
|
// billboard.visible = true;
|
||||||
|
// ...
|
||||||
|
// billboard.destroy();
|
||||||
|
//
|
||||||
|
// More on usage below. Examples in `examples/example/overlayPanelExample.js`.
|
||||||
|
//
|
||||||
|
// Note that including this file will delete `Overlays` from the global scope. All the
|
||||||
|
// functionality of `Overlays` is represented here, just better. If you try to use `Overlays`
|
||||||
|
// in tandem, there may be performance problems or nasty surprises.
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
// Delete `Overlays` from the global scope.
|
||||||
|
var Overlays = this.Overlays;
|
||||||
|
delete this.Overlays;
|
||||||
|
|
||||||
|
|
||||||
|
var ABSTRACT = null;
|
||||||
|
|
||||||
|
var overlays = {};
|
||||||
|
var panels = {};
|
||||||
|
|
||||||
|
var overlayTypes = {};
|
||||||
|
|
||||||
|
|
||||||
|
function generateOverlayClass(superclass, type, properties) {
|
||||||
|
var that;
|
||||||
|
if (type == ABSTRACT) {
|
||||||
|
that = function(type, params) {
|
||||||
|
superclass.call(this, type, params);
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
that = function(params) {
|
||||||
|
superclass.call(this, type, params);
|
||||||
|
};
|
||||||
|
overlayTypes[type] = that;
|
||||||
|
}
|
||||||
|
|
||||||
|
that.prototype = new superclass();
|
||||||
|
that.prototype.constructor = that;
|
||||||
|
|
||||||
|
properties.forEach(function(prop) {
|
||||||
|
Object.defineProperty(that.prototype, prop, {
|
||||||
|
get: function() {
|
||||||
|
return Overlays.getProperty(this._id, prop);
|
||||||
|
},
|
||||||
|
set: function(newValue) {
|
||||||
|
var keyValuePair = {};
|
||||||
|
keyValuePair[prop] = newValue;
|
||||||
|
this.setProperties(keyValuePair);
|
||||||
|
},
|
||||||
|
configurable: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return that;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a new JavaScript object for an overlay of given ID.
|
||||||
|
//
|
||||||
|
function makeOverlayFromId(id) {
|
||||||
|
var type = Overlays.getOverlayType(id);
|
||||||
|
if (!type) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var overlay = new overlayTypes[type]();
|
||||||
|
overlay._id = id;
|
||||||
|
overlays[id] = overlay;
|
||||||
|
return overlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get or create an overlay object from the id.
|
||||||
|
//
|
||||||
|
// @param knownOverlaysOnly (Optional: Boolean)
|
||||||
|
// If true, a new object will not be created.
|
||||||
|
// @param searchList (Optional: Object)
|
||||||
|
// Map of overlay id's and overlay objects. Can be generated with
|
||||||
|
// `OverlayManager.makeSearchList`.
|
||||||
|
//
|
||||||
|
function findOverlay(id, knownOverlaysOnly, searchList) {
|
||||||
|
if (id > 0) {
|
||||||
|
knownOverlaysOnly = Boolean(knownOverlaysOnly);
|
||||||
|
searchList = searchList || overlays;
|
||||||
|
var foundOverlay = searchList[id];
|
||||||
|
if (foundOverlay) {
|
||||||
|
return foundOverlay;
|
||||||
|
}
|
||||||
|
if (!knownOverlaysOnly) {
|
||||||
|
return makeOverlayFromId(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create a new JavaScript object for a panel of given ID.
|
||||||
|
//
|
||||||
|
function makePanelFromId(id) {
|
||||||
|
if (!Overlays.isAddedPanel(id)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var panel = new OverlayPanel();
|
||||||
|
panel._id = id;
|
||||||
|
overlays[id] = overlay;
|
||||||
|
return overlay;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get or create a panel object from the id.
|
||||||
|
//
|
||||||
|
// @param knownOverlaysOnly (Optional: Boolean)
|
||||||
|
// If true, a new object will not be created.
|
||||||
|
// @param searchList (Optional: Object)
|
||||||
|
// Map of overlay id's and overlay objects. Can be generated with
|
||||||
|
// `OverlayManager.makeSearchList`.
|
||||||
|
//
|
||||||
|
function findPanel(id, knownPanelsOnly, searchList) {
|
||||||
|
if (id > 0) {
|
||||||
|
knownPanelsOnly = Boolean(knownPanelsOnly);
|
||||||
|
searchList = searchList || panels;
|
||||||
|
var foundPanel = searchList[id];
|
||||||
|
if (foundPanel) {
|
||||||
|
return foundPanel;
|
||||||
|
}
|
||||||
|
if (!knownPanelsOnly) {
|
||||||
|
return makePanelFromId(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findOverlayOrPanel(id, knownObjectsOnly, searchList) {
|
||||||
|
return findOverlay(id, knownObjectsOnly, searchList) ||
|
||||||
|
findPanel(id, knownObjectsOnly, searchList);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var Overlay = (function() {
|
||||||
|
var that = function(type, params) {
|
||||||
|
if (type && params) {
|
||||||
|
this._id = Overlays.addOverlay(type, params);
|
||||||
|
overlays[this._id] = this;
|
||||||
|
} else {
|
||||||
|
this._id = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.constructor = that;
|
||||||
|
|
||||||
|
Object.defineProperty(that.prototype, "isLoaded", {
|
||||||
|
get: function() {
|
||||||
|
return Overlays.isLoaded(this._id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.defineProperty(that.prototype, "parentPanel", {
|
||||||
|
get: function() {
|
||||||
|
return findPanel(Overlays.getParentPanel(this._id));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
that.prototype.getTextSize = function(text) {
|
||||||
|
return Overlays.textSize(this._id, text);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.setProperties = function(properties) {
|
||||||
|
Overlays.editOverlay(this._id, properties);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.clone = function() {
|
||||||
|
return makeOverlayFromId(Overlays.cloneOverlay(this._id));
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.destroy = function() {
|
||||||
|
Overlays.deleteOverlay(this._id);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.isPanelAttachable = function() {
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
return generateOverlayClass(that, ABSTRACT, [
|
||||||
|
"alpha", "glowLevel", "pulseMax", "pulseMin", "pulsePeriod", "glowLevelPulse",
|
||||||
|
"alphaPulse", "colorPulse", "visible", "anchor"
|
||||||
|
]);
|
||||||
|
})();
|
||||||
|
|
||||||
|
// Supports multiple inheritance of properties. Just `concat` them onto the end of the
|
||||||
|
// properties list.
|
||||||
|
var PanelAttachable = ["offsetPosition", "offsetRotation", "offsetScale"];
|
||||||
|
var Billboardable = ["isFacingAvatar"];
|
||||||
|
|
||||||
|
var Overlay2D = generateOverlayClass(Overlay, ABSTRACT, [
|
||||||
|
"bounds", "x", "y", "width", "height"
|
||||||
|
]);
|
||||||
|
|
||||||
|
var Base3DOverlay = generateOverlayClass(Overlay, ABSTRACT, [
|
||||||
|
"position", "lineWidth", "rotation", "isSolid", "isFilled", "isWire", "isDashedLine",
|
||||||
|
"ignoreRayIntersection", "drawInFront", "drawOnHUD"
|
||||||
|
]);
|
||||||
|
|
||||||
|
var Planar3DOverlay = generateOverlayClass(Base3DOverlay, ABSTRACT, [
|
||||||
|
"dimensions"
|
||||||
|
]);
|
||||||
|
|
||||||
|
var Billboard3DOverlay = generateOverlayClass(Planar3DOverlay, ABSTRACT, [
|
||||||
|
].concat(PanelAttachable).concat(Billboardable));
|
||||||
|
Billboard3DOverlay.prototype.isPanelAttachable = function() { return true; };
|
||||||
|
|
||||||
|
var Volume3DOverlay = generateOverlayClass(Base3DOverlay, ABSTRACT, [
|
||||||
|
"dimensions"
|
||||||
|
]);
|
||||||
|
|
||||||
|
ImageOverlay = generateOverlayClass(Overlay2D, "image", [
|
||||||
|
"subImage", "imageURL"
|
||||||
|
]);
|
||||||
|
|
||||||
|
Image3DOverlay = generateOverlayClass(Billboard3DOverlay, "image3d", [
|
||||||
|
"url", "subImage"
|
||||||
|
]);
|
||||||
|
|
||||||
|
TextOverlay = generateOverlayClass(Overlay2D, "text", [
|
||||||
|
"font", "text", "backgroundColor", "backgroundAlpha", "leftMargin", "topMargin"
|
||||||
|
]);
|
||||||
|
|
||||||
|
Text3DOverlay = generateOverlayClass(Billboard3DOverlay, "text3d", [
|
||||||
|
"text", "backgroundColor", "backgroundAlpha", "lineHeight", "leftMargin", "topMargin",
|
||||||
|
"rightMargin", "bottomMargin"
|
||||||
|
]);
|
||||||
|
|
||||||
|
Cube3DOverlay = generateOverlayClass(Volume3DOverlay, "cube", [
|
||||||
|
"borderSize"
|
||||||
|
]);
|
||||||
|
|
||||||
|
Sphere3DOverlay = generateOverlayClass(Volume3DOverlay, "sphere", [
|
||||||
|
]);
|
||||||
|
|
||||||
|
Circle3DOverlay = generateOverlayClass(Planar3DOverlay, "circle3d", [
|
||||||
|
"startAt", "endAt", "outerRadius", "innerRadius", "hasTickMarks",
|
||||||
|
"majorTickMarksAngle", "minorTickMarksAngle", "majorTickMarksLength",
|
||||||
|
"minorTickMarksLength", "majorTickMarksColor", "minorTickMarksColor"
|
||||||
|
]);
|
||||||
|
|
||||||
|
Rectangle3DOverlay = generateOverlayClass(Planar3DOverlay, "rectangle3d", [
|
||||||
|
]);
|
||||||
|
|
||||||
|
Line3DOverlay = generateOverlayClass(Base3DOverlay, "line3d", [
|
||||||
|
"start", "end"
|
||||||
|
]);
|
||||||
|
|
||||||
|
Grid3DOverlay = generateOverlayClass(Planar3DOverlay, "grid", [
|
||||||
|
"minorGridWidth", "majorGridEvery"
|
||||||
|
]);
|
||||||
|
|
||||||
|
LocalModelsOverlay = generateOverlayClass(Volume3DOverlay, "localmodels", [
|
||||||
|
]);
|
||||||
|
|
||||||
|
ModelOverlay = generateOverlayClass(Volume3DOverlay, "model", [
|
||||||
|
"url", "dimensions", "textures"
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
OverlayPanel = (function() {
|
||||||
|
var that = function(params) {
|
||||||
|
this._id = Overlays.addPanel(params);
|
||||||
|
panels[this._id] = this;
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.constructor = that;
|
||||||
|
|
||||||
|
var props = [
|
||||||
|
"anchorPosition", "anchorPositionBinding", "anchorRotation", "anchorRotationBinding", "anchorScale", "visible"
|
||||||
|
].concat(PanelAttachable).concat(Billboardable)
|
||||||
|
|
||||||
|
props.forEach(function(prop) {
|
||||||
|
Object.defineProperty(that.prototype, prop, {
|
||||||
|
get: function() {
|
||||||
|
return Overlays.getPanelProperty(this._id, prop);
|
||||||
|
},
|
||||||
|
set: function(newValue) {
|
||||||
|
var keyValuePair = {};
|
||||||
|
keyValuePair[prop] = newValue;
|
||||||
|
this.setProperties(keyValuePair);
|
||||||
|
},
|
||||||
|
configurable: false
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.defineProperty(that.prototype, "parentPanel", {
|
||||||
|
get: function() {
|
||||||
|
return findPanel(Overlays.getParentPanel(this._id));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Object.defineProperty(that.prototype, "children", {
|
||||||
|
get: function() {
|
||||||
|
var idArray = Overlays.getPanelProperty(this._id, "children");
|
||||||
|
var objArray = [];
|
||||||
|
for (var i = 0; i < idArray.length; i++) {
|
||||||
|
objArray[i] = findOverlayOrPanel(idArray[i]);
|
||||||
|
}
|
||||||
|
return objArray;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
that.prototype.addChild = function(child) {
|
||||||
|
Overlays.setParentPanel(child._id, this._id);
|
||||||
|
return child;
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.removeChild = function(child) {
|
||||||
|
if (child.parentPanel === this) {
|
||||||
|
Overlays.setParentPanel(child._id, 0);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.setProperties = function(properties) {
|
||||||
|
Overlays.editPanel(this._id, properties);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.setChildrenVisible = function() {
|
||||||
|
this.children.forEach(function(child) {
|
||||||
|
child.visible = true;
|
||||||
|
if (child.setChildrenVisible !== undefined) {
|
||||||
|
child.setChildrenVisible();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
that.prototype.destroy = function() {
|
||||||
|
Overlays.deletePanel(this._id);
|
||||||
|
};
|
||||||
|
|
||||||
|
return that;
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
OverlayManager = {
|
||||||
|
findOnRay: function(pickRay, knownOverlaysOnly, searchList) {
|
||||||
|
var rayPickResult = Overlays.findRayIntersection(pickRay);
|
||||||
|
if (rayPickResult.intersects) {
|
||||||
|
return findOverlay(rayPickResult.overlayID, knownOverlaysOnly, searchList);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
findAtPoint: function(point, knownOverlaysOnly, searchList) {
|
||||||
|
var foundID = Overlays.getOverlayAtPoint(point);
|
||||||
|
if (foundID) {
|
||||||
|
return findOverlay(foundID, knownOverlaysOnly, searchList);
|
||||||
|
} else {
|
||||||
|
var pickRay = Camera.computePickRay(point.x, point.y);
|
||||||
|
return OverlayManager.findOnRay(pickRay, knownOverlaysOnly, searchList);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
makeSearchList: function(array) {
|
||||||
|
var searchList = {};
|
||||||
|
array.forEach(function(object) {
|
||||||
|
searchList[object._id] = object;
|
||||||
|
});
|
||||||
|
return searchList;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Threadsafe cleanup of JavaScript objects.
|
||||||
|
|
||||||
|
function onOverlayDeleted(id) {
|
||||||
|
if (id in overlays) {
|
||||||
|
if (overlays[id].parentPanel) {
|
||||||
|
overlays[id].parentPanel.removeChild(overlays[id]);
|
||||||
|
}
|
||||||
|
delete overlays[id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onPanelDeleted(id) {
|
||||||
|
if (id in panels) {
|
||||||
|
if (panels[id].parentPanel) {
|
||||||
|
panels[id].parentPanel.removeChild(panels[id]);
|
||||||
|
}
|
||||||
|
delete panels[id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Overlays.overlayDeleted.connect(onOverlayDeleted);
|
||||||
|
Overlays.panelDeleted.connect(onPanelDeleted);
|
||||||
|
})();
|
BIN
hifi-content/alessandro/dev/models/cleanRoom.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/cleanRoom.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/desk.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/desk.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/hat1model.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/hat1model.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/hat1preview.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/hat1preview.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/hat2model.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/hat2model.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/hat2preview.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/hat2preview.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/hat3model.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/hat3model.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/hat3preview.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/hat3preview.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/sunglasses1model.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/sunglasses1model.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/sunglasses1preview.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/sunglasses1preview.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/sunglasses2model.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/sunglasses2model.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/sunglasses2preview.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/sunglasses2preview.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/sunglasses3model.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/sunglasses3model.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alessandro/dev/models/sunglasses3preview.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alessandro/dev/models/sunglasses3preview.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/AndroidMedia/MobileUI.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/AndroidMedia/MobileUI.png
(Stored with Git LFS)
Normal file
Binary file not shown.
155
hifi-content/alexia/Apps/Template/VRFontTest.html
Normal file
155
hifi-content/alexia/Apps/Template/VRFontTest.html
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
<!--
|
||||||
|
// VRFontTest.html
|
||||||
|
//
|
||||||
|
// Created by Alexia Mandeville on 30 Apr 2018
|
||||||
|
// Copyright 2017 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
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>VR Font Test</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600,700"" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
width: 100%;
|
||||||
|
font-family: 'Raleway', sans-serif;
|
||||||
|
color: white;
|
||||||
|
background: linear-gradient(#2b2b2b, #0f212e);
|
||||||
|
}
|
||||||
|
.top-bar {
|
||||||
|
height: 90px;
|
||||||
|
background: linear-gradient(#2b2b2b, #1e1e1e);
|
||||||
|
font-weight: bold;
|
||||||
|
padding-left: 30px;
|
||||||
|
font-size: 22px;
|
||||||
|
padding-right: 30px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
width: 480px;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
margin-top: 70px;
|
||||||
|
padding: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
input[type=button] {
|
||||||
|
font-family: 'Raleway';
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 22px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
vertical-align: top;
|
||||||
|
height: 50px;
|
||||||
|
min-width: 120px;
|
||||||
|
padding: 0px 18px;
|
||||||
|
margin-right: 6px;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: none;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #000;
|
||||||
|
background: linear-gradient(#343434 20%, #000 100%);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
input[type=button].red {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #94132e;
|
||||||
|
background: linear-gradient(#d42043 20%, #94132e 100%);
|
||||||
|
}
|
||||||
|
input[type=button].blue {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1080b8;
|
||||||
|
background: linear-gradient(#00b4ef 20%, #1080b8 100%);
|
||||||
|
}
|
||||||
|
input[type=button].white {
|
||||||
|
color: #121212;
|
||||||
|
background-color: #afafaf;
|
||||||
|
background: linear-gradient(#fff 20%, #afafaf 100%);
|
||||||
|
}
|
||||||
|
input[type=button]:enabled:hover {
|
||||||
|
background: linear-gradient(#000, #000);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button].red:enabled:hover {
|
||||||
|
background: linear-gradient(#d42043, #d42043);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button].blue:enabled:hover {
|
||||||
|
background: linear-gradient(#00b4ef, #00b4ef);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button].white:enabled:hover {
|
||||||
|
background: linear-gradient(#fff, #fff);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button]:active {
|
||||||
|
background: linear-gradient(#343434, #343434);
|
||||||
|
}
|
||||||
|
input[type=button].red:active {
|
||||||
|
background: linear-gradient(#94132e, #94132e);
|
||||||
|
}
|
||||||
|
input[type=button].blue:active {
|
||||||
|
background: linear-gradient(#1080b8, #1080b8);
|
||||||
|
}
|
||||||
|
input[type=button].white:active {
|
||||||
|
background: linear-gradient(#afafaf, #afafaf);
|
||||||
|
}
|
||||||
|
input[type=button]:disabled {
|
||||||
|
color: #252525;
|
||||||
|
background: linear-gradient(#575757 20%, #252525 100%);
|
||||||
|
}
|
||||||
|
input[type=button][pressed=pressed] {
|
||||||
|
color: #00b4ef;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="top-bar">
|
||||||
|
<h4>VR Font Test</h4>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<input type="button" class="button white" value="Bold">
|
||||||
|
<input type="button" class="button white" value="Normal">
|
||||||
|
<br><br>
|
||||||
|
<p style="font-size:30px">quiet</p>
|
||||||
|
<p style="font-size:28px">fence proud</p>
|
||||||
|
<p style="font-size:26px">neat royal voyage</p>
|
||||||
|
<p style="font-size:24px">stain form</p>
|
||||||
|
<p style="font-size:22px">lamp notice dime</p>
|
||||||
|
<p style="font-size:20px">found hover country</p>
|
||||||
|
<p style="font-size:18px">cow wise glow</p>
|
||||||
|
<p style="font-size:16px">donkey cheer shock cup</p>
|
||||||
|
<p style="font-size:14px">sin branch sheet knee</p>
|
||||||
|
<p style="font-size:12px">alert blue desire teeny</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||||
|
<script>
|
||||||
|
function main() {
|
||||||
|
// Send an event to template.js when the page loads and is ready to get things rolling
|
||||||
|
console.log("document ready");
|
||||||
|
var readyEvent = {
|
||||||
|
"type": "ready",
|
||||||
|
};
|
||||||
|
// The event bridge handles event represented as a string the best. So here we first create a Javascript object, then convert to string
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
|
// Send an event when user click on each of the buttons
|
||||||
|
$(".button").click(function(){
|
||||||
|
var clickEvent = {
|
||||||
|
"type": "click",
|
||||||
|
"data": this.value
|
||||||
|
};
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(clickEvent));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(main);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
69
hifi-content/alexia/Apps/Template/VRFontTest.js
Normal file
69
hifi-content/alexia/Apps/Template/VRFontTest.js
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
//
|
||||||
|
// template.js
|
||||||
|
//
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var APP_NAME = "VR FONT";
|
||||||
|
// Link to your app's HTML file
|
||||||
|
var APP_URL_BOLD = "http://hifi-content.s3.amazonaws.com/alexia/Apps/Template/VRFontTestBold.html";
|
||||||
|
var APP_URL_NORMAL = "http://hifi-content.s3.amazonaws.com/alexia/Apps/Template/VRFontTest.html";
|
||||||
|
// Path to the icon art for your app
|
||||||
|
var APP_ICON = "https://hifi-content.s3.amazonaws.com/faye/gemstoneMagicMaker/gemstoneAppIcon.svg";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Get a reference to the tablet
|
||||||
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
||||||
|
// The following lines create a button on the tablet's menu screen
|
||||||
|
var button = tablet.addButton({
|
||||||
|
icon: APP_ICON,
|
||||||
|
text: APP_NAME
|
||||||
|
});
|
||||||
|
|
||||||
|
// When user click the app button, we'll display our app on the tablet screen
|
||||||
|
function onClicked() {
|
||||||
|
tablet.gotoWebScreen(APP_URL_NORMAL);
|
||||||
|
}
|
||||||
|
button.clicked.connect(onClicked);
|
||||||
|
|
||||||
|
// Helper function that gives us a position right in front of the user
|
||||||
|
function getPositionToCreateEntity() {
|
||||||
|
var direction = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var distance = 0.5;
|
||||||
|
var position = Vec3.sum(MyAvatar.position, Vec3.multiply(direction, distance));
|
||||||
|
position.y += 0.5;
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle the events we're recieving from the web UI
|
||||||
|
function onWebEventReceived(event) {
|
||||||
|
print("template.js received a web event:" + event);
|
||||||
|
|
||||||
|
// Converts the event to a JavasScript Object
|
||||||
|
if (typeof event === "string") {
|
||||||
|
event = JSON.parse(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.type === "click") {
|
||||||
|
// Define the entity properties of for each of the gemstone, then add it to the scene
|
||||||
|
|
||||||
|
if (event.data === "Bold") {
|
||||||
|
tablet.gotoWebScreen(APP_URL_BOLD);
|
||||||
|
} else if (event.data === "Normal") {
|
||||||
|
tablet.gotoWebScreen(APP_URL_NORMAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tablet.webEventReceived.connect(onWebEventReceived);
|
||||||
|
|
||||||
|
// Provide a way to "uninstall" the app
|
||||||
|
// Here, we write a function called "cleanup" which gets executed when
|
||||||
|
// this script stops running. It'll remove the app button from the tablet.
|
||||||
|
function cleanup() {
|
||||||
|
tablet.removeButton(button);
|
||||||
|
}
|
||||||
|
Script.scriptEnding.connect(cleanup);
|
||||||
|
}());
|
156
hifi-content/alexia/Apps/Template/VRFontTestBold.html
Normal file
156
hifi-content/alexia/Apps/Template/VRFontTestBold.html
Normal file
|
@ -0,0 +1,156 @@
|
||||||
|
<!--
|
||||||
|
// VRFontTestBold.html
|
||||||
|
//
|
||||||
|
// Created by Alexia Mandeville on 30 Apr 2018
|
||||||
|
// Copyright 2017 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
|
||||||
|
-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>VR Font Test</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Raleway:300,400,600,700"" rel="stylesheet">
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
width: 100%;
|
||||||
|
font-family: 'Raleway', sans-serif;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
background: linear-gradient(#2b2b2b, #0f212e);
|
||||||
|
}
|
||||||
|
.top-bar {
|
||||||
|
height: 90px;
|
||||||
|
background: linear-gradient(#2b2b2b, #1e1e1e);
|
||||||
|
font-weight: bold;
|
||||||
|
padding-left: 30px;
|
||||||
|
font-size: 22px;
|
||||||
|
padding-right: 30px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
position: fixed;
|
||||||
|
width: 480px;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
margin-top: 70px;
|
||||||
|
padding: 30px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
input[type=button] {
|
||||||
|
font-family: 'Raleway';
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 22px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
vertical-align: top;
|
||||||
|
height: 50px;
|
||||||
|
min-width: 120px;
|
||||||
|
padding: 0px 18px;
|
||||||
|
margin-right: 6px;
|
||||||
|
border-radius: 5px;
|
||||||
|
border: none;
|
||||||
|
color: #fff;
|
||||||
|
background-color: #000;
|
||||||
|
background: linear-gradient(#343434 20%, #000 100%);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
input[type=button].red {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #94132e;
|
||||||
|
background: linear-gradient(#d42043 20%, #94132e 100%);
|
||||||
|
}
|
||||||
|
input[type=button].blue {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #1080b8;
|
||||||
|
background: linear-gradient(#00b4ef 20%, #1080b8 100%);
|
||||||
|
}
|
||||||
|
input[type=button].white {
|
||||||
|
color: #121212;
|
||||||
|
background-color: #afafaf;
|
||||||
|
background: linear-gradient(#fff 20%, #afafaf 100%);
|
||||||
|
}
|
||||||
|
input[type=button]:enabled:hover {
|
||||||
|
background: linear-gradient(#000, #000);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button].red:enabled:hover {
|
||||||
|
background: linear-gradient(#d42043, #d42043);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button].blue:enabled:hover {
|
||||||
|
background: linear-gradient(#00b4ef, #00b4ef);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button].white:enabled:hover {
|
||||||
|
background: linear-gradient(#fff, #fff);
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
input[type=button]:active {
|
||||||
|
background: linear-gradient(#343434, #343434);
|
||||||
|
}
|
||||||
|
input[type=button].red:active {
|
||||||
|
background: linear-gradient(#94132e, #94132e);
|
||||||
|
}
|
||||||
|
input[type=button].blue:active {
|
||||||
|
background: linear-gradient(#1080b8, #1080b8);
|
||||||
|
}
|
||||||
|
input[type=button].white:active {
|
||||||
|
background: linear-gradient(#afafaf, #afafaf);
|
||||||
|
}
|
||||||
|
input[type=button]:disabled {
|
||||||
|
color: #252525;
|
||||||
|
background: linear-gradient(#575757 20%, #252525 100%);
|
||||||
|
}
|
||||||
|
input[type=button][pressed=pressed] {
|
||||||
|
color: #00b4ef;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="top-bar">
|
||||||
|
<h4>VR Font Test</h4>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
|
||||||
|
<input type="button" class="button white" value="Bold">
|
||||||
|
<input type="button" class="button white" value="Normal">
|
||||||
|
<br><br>
|
||||||
|
<p style="font-size:30px">copper</p>
|
||||||
|
<p style="font-size:28px">explain truck</p>
|
||||||
|
<p style="font-size:26px">neat unite branch</p>
|
||||||
|
<p style="font-size:24px">educated hum</p>
|
||||||
|
<p style="font-size:22px">decisive notice far </p>
|
||||||
|
<p style="font-size:20px">pig intelligent birthday</p>
|
||||||
|
<p style="font-size:18px">calm month glow</p>
|
||||||
|
<p style="font-size:16px">unusual man boring arrest</p>
|
||||||
|
<p style="font-size:14px">pies murky sheet stiff</p>
|
||||||
|
<p style="font-size:12px">overflow blue cobweb guess</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
|
||||||
|
<script>
|
||||||
|
function main() {
|
||||||
|
// Send an event to template.js when the page loads and is ready to get things rolling
|
||||||
|
console.log("document ready");
|
||||||
|
var readyEvent = {
|
||||||
|
"type": "ready",
|
||||||
|
};
|
||||||
|
// The event bridge handles event represented as a string the best. So here we first create a Javascript object, then convert to string
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
|
// Send an event when user click on each of the buttons
|
||||||
|
$(".button").click(function(){
|
||||||
|
var clickEvent = {
|
||||||
|
"type": "click",
|
||||||
|
"data": this.value
|
||||||
|
};
|
||||||
|
EventBridge.emitWebEvent(JSON.stringify(clickEvent));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(main);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
85
hifi-content/alexia/Avatars/Bevi/FST/bevi.fst
Normal file
85
hifi-content/alexia/Avatars/Bevi/FST/bevi.fst
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
name = bevi
|
||||||
|
type = body+head
|
||||||
|
scale = 1
|
||||||
|
filename = bevi/bevi.fbx
|
||||||
|
texdir = bevi/textures
|
||||||
|
joint = jointRightHand = RightHand
|
||||||
|
joint = jointHead = Head
|
||||||
|
joint = jointRoot = Hips
|
||||||
|
joint = jointNeck = Neck
|
||||||
|
joint = jointLean = Spine
|
||||||
|
joint = jointEyeLeft = LeftEye
|
||||||
|
joint = jointLeftHand = LeftHand
|
||||||
|
joint = jointEyeRight = RightEye
|
||||||
|
freeJoint = LeftArm
|
||||||
|
freeJoint = LeftForeArm
|
||||||
|
freeJoint = RightArm
|
||||||
|
freeJoint = RightForeArm
|
||||||
|
jointIndex = LeftHandRing4 = 49
|
||||||
|
jointIndex = RightHandThumb4 = 21
|
||||||
|
jointIndex = LeftHandIndex2 = 51
|
||||||
|
jointIndex = LeftHandIndex4 = 53
|
||||||
|
jointIndex = RightHandRing1 = 26
|
||||||
|
jointIndex = RightToe_End = 5
|
||||||
|
jointIndex = LeftHandThumb3 = 56
|
||||||
|
jointIndex = RightHandThumb3 = 20
|
||||||
|
jointIndex = RightHandRing2 = 27
|
||||||
|
jointIndex = LeftHandRing1 = 46
|
||||||
|
jointIndex = LeftHandIndex1 = 50
|
||||||
|
jointIndex = Hips = 0
|
||||||
|
jointIndex = Spine = 11
|
||||||
|
jointIndex = RightHand = 17
|
||||||
|
jointIndex = RightHandPinky3 = 32
|
||||||
|
jointIndex = Spine1 = 12
|
||||||
|
jointIndex = LeftHandPinky4 = 45
|
||||||
|
jointIndex = RightHandMiddle2 = 35
|
||||||
|
jointIndex = LeftFoot = 8
|
||||||
|
jointIndex = RightHandMiddle3 = 36
|
||||||
|
jointIndex = RightHandMiddle1 = 34
|
||||||
|
jointIndex = LeftHandMiddle2 = 59
|
||||||
|
jointIndex = LeftEye = 64
|
||||||
|
jointIndex = RightHandRing4 = 29
|
||||||
|
jointIndex = LeftHandRing3 = 48
|
||||||
|
jointIndex = RightHandIndex1 = 22
|
||||||
|
jointIndex = LeftHandMiddle1 = 58
|
||||||
|
jointIndex = RightUpLeg = 1
|
||||||
|
jointIndex = LeftHandPinky1 = 42
|
||||||
|
jointIndex = RightHandIndex3 = 24
|
||||||
|
jointIndex = LeftHandThumb1 = 54
|
||||||
|
jointIndex = RightHandPinky2 = 31
|
||||||
|
jointIndex = RightHandRing3 = 28
|
||||||
|
jointIndex = RightHandIndex2 = 23
|
||||||
|
jointIndex = Spine2 = 13
|
||||||
|
jointIndex = LeftHandRing2 = 47
|
||||||
|
jointIndex = RightLeg = 2
|
||||||
|
jointIndex = RightFoot = 3
|
||||||
|
jointIndex = RightArm = 15
|
||||||
|
jointIndex = LeftHandIndex3 = 52
|
||||||
|
jointIndex = pCube1 = 67
|
||||||
|
jointIndex = RightHandThumb2 = 19
|
||||||
|
jointIndex = LeftForeArm = 40
|
||||||
|
jointIndex = LeftHandPinky3 = 44
|
||||||
|
jointIndex = LeftHandThumb4 = 57
|
||||||
|
jointIndex = LeftToeBase = 9
|
||||||
|
jointIndex = RightForeArm = 16
|
||||||
|
jointIndex = RightHandThumb1 = 18
|
||||||
|
jointIndex = LeftHandMiddle3 = 60
|
||||||
|
jointIndex = LeftArm = 39
|
||||||
|
jointIndex = LeftHandPinky2 = 43
|
||||||
|
jointIndex = RightHandMiddle4 = 37
|
||||||
|
jointIndex = HeadTop_End = 66
|
||||||
|
jointIndex = RightHandIndex4 = 25
|
||||||
|
jointIndex = RightToeBase = 4
|
||||||
|
jointIndex = LeftLeg = 7
|
||||||
|
jointIndex = RightHandPinky4 = 33
|
||||||
|
jointIndex = Head = 63
|
||||||
|
jointIndex = RightHandPinky1 = 30
|
||||||
|
jointIndex = RightEye = 65
|
||||||
|
jointIndex = LeftToe_End = 10
|
||||||
|
jointIndex = RightShoulder = 14
|
||||||
|
jointIndex = LeftShoulder = 38
|
||||||
|
jointIndex = LeftHandMiddle4 = 61
|
||||||
|
jointIndex = LeftHandThumb2 = 55
|
||||||
|
jointIndex = LeftUpLeg = 6
|
||||||
|
jointIndex = LeftHand = 41
|
||||||
|
jointIndex = Neck = 62
|
BIN
hifi-content/alexia/Avatars/Bevi/FST/bevi/bevi.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Bevi/FST/bevi/bevi.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/Avatars/Bevi/bubble.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Bevi/bubble.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/Avatars/Bevi/coconut.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Bevi/coconut.png
(Stored with Git LFS)
Normal file
Binary file not shown.
91
hifi-content/alexia/Avatars/Cloud/Cloud.fst
Normal file
91
hifi-content/alexia/Avatars/Cloud/Cloud.fst
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
name = Cloud
|
||||||
|
type = body+head
|
||||||
|
scale = 1
|
||||||
|
filename = Cloud/Cloud.fbx
|
||||||
|
texdir = Cloud/textures
|
||||||
|
script = http://hifi-content.s3.amazonaws.com/alexia/Avatars/Stormcloud/rainParticles.js
|
||||||
|
script = http://hifi-content.s3.amazonaws.com/alexia/Avatars/Stormcloud/lightningParticles.js
|
||||||
|
joint = jointLean = Spine
|
||||||
|
joint = jointEyeLeft = LeftEye
|
||||||
|
joint = jointNeck = Neck
|
||||||
|
joint = jointRightHand = RightHand
|
||||||
|
joint = jointEyeRight = RightEye
|
||||||
|
joint = jointHead = Head
|
||||||
|
joint = jointLeftHand = LeftHand
|
||||||
|
joint = jointRoot = Hips
|
||||||
|
freeJoint = LeftArm
|
||||||
|
freeJoint = LeftForeArm
|
||||||
|
freeJoint = RightArm
|
||||||
|
freeJoint = RightForeArm
|
||||||
|
jointIndex = MeshGroup = 4
|
||||||
|
jointIndex = Spine = 16
|
||||||
|
jointIndex = LeftHandThumb4 = 62
|
||||||
|
jointIndex = LeftHandMiddle3 = 65
|
||||||
|
jointIndex = LeftHandMiddle2 = 64
|
||||||
|
jointIndex = LeftHandMiddle4 = 66
|
||||||
|
jointIndex = RightHandThumb1 = 23
|
||||||
|
jointIndex = LeftArm = 44
|
||||||
|
jointIndex = RightHandIndex1 = 27
|
||||||
|
jointIndex = LeftHandRing4 = 54
|
||||||
|
jointIndex = LeftHandPinky3 = 49
|
||||||
|
jointIndex = LeftHandIndex4 = 58
|
||||||
|
jointIndex = LeftHandIndex2 = 56
|
||||||
|
jointIndex = LeftShoulder = 43
|
||||||
|
jointIndex = RightHandRing2 = 32
|
||||||
|
jointIndex = Hips = 5
|
||||||
|
jointIndex = polySurface2 = 3
|
||||||
|
jointIndex = RightHandIndex3 = 29
|
||||||
|
jointIndex = RightHandPinky3 = 37
|
||||||
|
jointIndex = RightFoot = 8
|
||||||
|
jointIndex = LeftHandThumb1 = 59
|
||||||
|
jointIndex = RightHandThumb2 = 24
|
||||||
|
jointIndex = RightHandRing3 = 33
|
||||||
|
jointIndex = RightEye = 70
|
||||||
|
jointIndex = RightHandThumb4 = 26
|
||||||
|
jointIndex = polySurface4 = 2
|
||||||
|
jointIndex = LeftHandIndex1 = 55
|
||||||
|
jointIndex = LeftHandThumb2 = 60
|
||||||
|
jointIndex = RightHandIndex4 = 30
|
||||||
|
jointIndex = LeftFoot = 13
|
||||||
|
jointIndex = RightHandRing1 = 31
|
||||||
|
jointIndex = RightHandMiddle3 = 41
|
||||||
|
jointIndex = RightUpLeg = 6
|
||||||
|
jointIndex = RightHandMiddle1 = 39
|
||||||
|
jointIndex = LeftLeg = 12
|
||||||
|
jointIndex = RightHand = 22
|
||||||
|
jointIndex = RightHandMiddle2 = 40
|
||||||
|
jointIndex = RightToe_End = 10
|
||||||
|
jointIndex = LeftToe_End = 15
|
||||||
|
jointIndex = LeftUpLeg = 11
|
||||||
|
jointIndex = RightHandPinky1 = 35
|
||||||
|
jointIndex = LeftHandMiddle1 = 63
|
||||||
|
jointIndex = LeftHandThumb3 = 61
|
||||||
|
jointIndex = LeftForeArm = 45
|
||||||
|
jointIndex = RightArm = 20
|
||||||
|
jointIndex = Spine2 = 18
|
||||||
|
jointIndex = Head = 68
|
||||||
|
jointIndex = LeftHandRing3 = 53
|
||||||
|
jointIndex = LeftToeBase = 14
|
||||||
|
jointIndex = LeftHandPinky4 = 50
|
||||||
|
jointIndex = HeadTop_End = 71
|
||||||
|
jointIndex = LeftHandPinky2 = 48
|
||||||
|
jointIndex = RightHandPinky4 = 38
|
||||||
|
jointIndex = RightHandMiddle4 = 42
|
||||||
|
jointIndex = pPlane1 = 0
|
||||||
|
jointIndex = RightHandRing4 = 34
|
||||||
|
jointIndex = RightForeArm = 21
|
||||||
|
jointIndex = RightToeBase = 9
|
||||||
|
jointIndex = LeftHand = 46
|
||||||
|
jointIndex = RightShoulder = 19
|
||||||
|
jointIndex = Spine1 = 17
|
||||||
|
jointIndex = cloud = 1
|
||||||
|
jointIndex = RightHandThumb3 = 25
|
||||||
|
jointIndex = RightHandIndex2 = 28
|
||||||
|
jointIndex = RightHandPinky2 = 36
|
||||||
|
jointIndex = LeftHandRing2 = 52
|
||||||
|
jointIndex = Neck = 67
|
||||||
|
jointIndex = RightLeg = 7
|
||||||
|
jointIndex = LeftEye = 69
|
||||||
|
jointIndex = LeftHandIndex3 = 57
|
||||||
|
jointIndex = LeftHandPinky1 = 47
|
||||||
|
jointIndex = LeftHandRing1 = 51
|
BIN
hifi-content/alexia/Avatars/Cloud/Cloud/Cloud.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Cloud/Cloud/Cloud.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/Avatars/Cloud/Cloud/textures/Cloud.jpg
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Cloud/Cloud/textures/Cloud.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/Avatars/Cloud/Cloud/textures/Cloudface0000.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Cloud/Cloud/textures/Cloudface0000.png
(Stored with Git LFS)
Normal file
Binary file not shown.
90
hifi-content/alexia/Avatars/DroopyCloudBind/cloudHappy.fst
Normal file
90
hifi-content/alexia/Avatars/DroopyCloudBind/cloudHappy.fst
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
name = cloudHappy
|
||||||
|
type = body+head
|
||||||
|
scale = 1
|
||||||
|
filename = cloudHappy/cloudHappy.fbx
|
||||||
|
texdir = cloudHappy/textures
|
||||||
|
joint = jointEyeLeft = LeftEye
|
||||||
|
joint = jointHead = Head
|
||||||
|
joint = jointEyeRight = RightEye
|
||||||
|
joint = jointLean = Spine
|
||||||
|
joint = jointRoot = Hips
|
||||||
|
joint = jointRightHand = RightHand
|
||||||
|
joint = jointNeck = Neck
|
||||||
|
joint = jointLeftHand = LeftHand
|
||||||
|
freeJoint = LeftArm
|
||||||
|
freeJoint = LeftForeArm
|
||||||
|
freeJoint = RightArm
|
||||||
|
freeJoint = RightForeArm
|
||||||
|
jointIndex = Spine2 = 18
|
||||||
|
jointIndex = RightHandIndex4 = 31
|
||||||
|
jointIndex = Hips = 5
|
||||||
|
jointIndex = RightHandIndex3 = 30
|
||||||
|
jointIndex = LeftToe_End = 15
|
||||||
|
jointIndex = LeftHandPinky1 = 48
|
||||||
|
jointIndex = LeftHandIndex3 = 58
|
||||||
|
jointIndex = LeftHandRing4 = 55
|
||||||
|
jointIndex = LeftHand = 47
|
||||||
|
jointIndex = RightHandRing3 = 34
|
||||||
|
jointIndex = LeftHandIndex4 = 59
|
||||||
|
jointIndex = cloud = 1
|
||||||
|
jointIndex = polySurface4 = 2
|
||||||
|
jointIndex = RightHandThumb3 = 26
|
||||||
|
jointIndex = LeftToeBase = 14
|
||||||
|
jointIndex = LeftHandIndex1 = 56
|
||||||
|
jointIndex = LeftForeArm = 46
|
||||||
|
jointIndex = RightHandPinky1 = 36
|
||||||
|
jointIndex = LeftHandPinky3 = 50
|
||||||
|
jointIndex = Neck = 68
|
||||||
|
jointIndex = RightHand = 23
|
||||||
|
jointIndex = RightHandRing2 = 33
|
||||||
|
jointIndex = RightLeg = 7
|
||||||
|
jointIndex = RightHandThumb2 = 25
|
||||||
|
jointIndex = LeftHandThumb3 = 62
|
||||||
|
jointIndex = RightHandPinky4 = 39
|
||||||
|
jointIndex = RightHandIndex1 = 28
|
||||||
|
jointIndex = polySurface2 = 3
|
||||||
|
jointIndex = pPlane1 = 0
|
||||||
|
jointIndex = RightHandMiddle3 = 42
|
||||||
|
jointIndex = LeftEye = 70
|
||||||
|
jointIndex = LeftHandMiddle4 = 67
|
||||||
|
jointIndex = LeftHandIndex2 = 57
|
||||||
|
jointIndex = LeftFoot = 13
|
||||||
|
jointIndex = LeftHandRing2 = 53
|
||||||
|
jointIndex = RightArm = 21
|
||||||
|
jointIndex = Spine1 = 17
|
||||||
|
jointIndex = RightHandPinky3 = 38
|
||||||
|
jointIndex = RightHandMiddle1 = 40
|
||||||
|
jointIndex = LeftHandRing3 = 54
|
||||||
|
jointIndex = RightUpLeg = 6
|
||||||
|
jointIndex = LeftHandPinky2 = 49
|
||||||
|
jointIndex = LeftArm = 45
|
||||||
|
jointIndex = RightFoot = 8
|
||||||
|
jointIndex = RightToe_End = 10
|
||||||
|
jointIndex = LeftHandThumb2 = 61
|
||||||
|
jointIndex = Spine = 16
|
||||||
|
jointIndex = LeftHandThumb1 = 60
|
||||||
|
jointIndex = LeftUpLeg = 11
|
||||||
|
jointIndex = RightToeBase = 9
|
||||||
|
jointIndex = LeftLeg = 12
|
||||||
|
jointIndex = LeftHandThumb4 = 63
|
||||||
|
jointIndex = joint = 19
|
||||||
|
jointIndex = LeftHandMiddle2 = 65
|
||||||
|
jointIndex = LeftHandMiddle1 = 64
|
||||||
|
jointIndex = RightHandRing1 = 32
|
||||||
|
jointIndex = RightHandRing4 = 35
|
||||||
|
jointIndex = RightShoulder = 20
|
||||||
|
jointIndex = LeftShoulder = 44
|
||||||
|
jointIndex = RightHandThumb1 = 24
|
||||||
|
jointIndex = LeftHandRing1 = 52
|
||||||
|
jointIndex = RightHandPinky2 = 37
|
||||||
|
jointIndex = RightHandMiddle2 = 41
|
||||||
|
jointIndex = HeadTop_End = 72
|
||||||
|
jointIndex = RightHandMiddle4 = 43
|
||||||
|
jointIndex = LeftHandPinky4 = 51
|
||||||
|
jointIndex = Head = 69
|
||||||
|
jointIndex = LeftHandMiddle3 = 66
|
||||||
|
jointIndex = RightEye = 71
|
||||||
|
jointIndex = RightHandIndex2 = 29
|
||||||
|
jointIndex = RightHandThumb4 = 27
|
||||||
|
jointIndex = RightForeArm = 22
|
||||||
|
jointIndex = MeshGroup = 4
|
BIN
hifi-content/alexia/Avatars/DroopyCloudBind/cloudHappy/cloudHappy.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/DroopyCloudBind/cloudHappy/cloudHappy.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
91
hifi-content/alexia/Avatars/HappyCloud/CloudHappy.fst
Normal file
91
hifi-content/alexia/Avatars/HappyCloud/CloudHappy.fst
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
name = CloudHappy
|
||||||
|
type = body+head
|
||||||
|
scale = 1
|
||||||
|
filename = CloudHappy/CloudHappy.fbx
|
||||||
|
texdir = CloudHappy/textures
|
||||||
|
script = http://hifi-content.s3.amazonaws.com/alexia/Avatars/HappyCloud/rainbowParticles.js
|
||||||
|
joint = jointNeck = Neck
|
||||||
|
joint = jointLeftHand = LeftHand
|
||||||
|
joint = jointEyeLeft = LeftEye
|
||||||
|
joint = jointRightHand = RightHand
|
||||||
|
joint = jointEyeRight = RightEye
|
||||||
|
joint = jointRoot = Hips
|
||||||
|
joint = jointLean = Spine
|
||||||
|
joint = jointHead = Head
|
||||||
|
freeJoint = LeftArm
|
||||||
|
freeJoint = LeftForeArm
|
||||||
|
freeJoint = RightArm
|
||||||
|
freeJoint = RightForeArm
|
||||||
|
jointIndex = RightHand = 23
|
||||||
|
jointIndex = LeftHandPinky2 = 49
|
||||||
|
jointIndex = LeftHandMiddle4 = 67
|
||||||
|
jointIndex = LeftShoulder = 44
|
||||||
|
jointIndex = Hips = 5
|
||||||
|
jointIndex = LeftArm = 45
|
||||||
|
jointIndex = LeftHandIndex3 = 58
|
||||||
|
jointIndex = LeftToe_End = 15
|
||||||
|
jointIndex = RightHandRing3 = 34
|
||||||
|
jointIndex = RightLeg = 7
|
||||||
|
jointIndex = LeftHandPinky1 = 48
|
||||||
|
jointIndex = polySurface2 = 3
|
||||||
|
jointIndex = RightHandMiddle2 = 41
|
||||||
|
jointIndex = RightHandRing1 = 32
|
||||||
|
jointIndex = HeadTop_End = 72
|
||||||
|
jointIndex = RightHandMiddle4 = 43
|
||||||
|
jointIndex = Spine1 = 17
|
||||||
|
jointIndex = RightHandRing4 = 35
|
||||||
|
jointIndex = LeftToeBase = 14
|
||||||
|
jointIndex = LeftHandRing3 = 54
|
||||||
|
jointIndex = RightHandPinky3 = 38
|
||||||
|
jointIndex = RightHandMiddle3 = 42
|
||||||
|
jointIndex = LeftHandThumb1 = 60
|
||||||
|
jointIndex = RightHandRing2 = 33
|
||||||
|
jointIndex = Spine2 = 18
|
||||||
|
jointIndex = RightHandIndex1 = 28
|
||||||
|
jointIndex = RightToeBase = 9
|
||||||
|
jointIndex = LeftUpLeg = 11
|
||||||
|
jointIndex = LeftHandThumb4 = 63
|
||||||
|
jointIndex = RightArm = 21
|
||||||
|
jointIndex = RightHandThumb2 = 25
|
||||||
|
jointIndex = RightHandPinky4 = 39
|
||||||
|
jointIndex = RightToe_End = 10
|
||||||
|
jointIndex = LeftHandIndex2 = 57
|
||||||
|
jointIndex = RightHandPinky2 = 37
|
||||||
|
jointIndex = LeftHandThumb3 = 62
|
||||||
|
jointIndex = RightHandIndex3 = 30
|
||||||
|
jointIndex = RightForeArm = 22
|
||||||
|
jointIndex = LeftEye = 70
|
||||||
|
jointIndex = RightHandIndex4 = 31
|
||||||
|
jointIndex = RightFoot = 8
|
||||||
|
jointIndex = RightHandThumb3 = 26
|
||||||
|
jointIndex = polySurface4 = 2
|
||||||
|
jointIndex = LeftForeArm = 46
|
||||||
|
jointIndex = RightHandIndex2 = 29
|
||||||
|
jointIndex = LeftHandRing4 = 55
|
||||||
|
jointIndex = MeshGroup = 4
|
||||||
|
jointIndex = LeftHandRing1 = 52
|
||||||
|
jointIndex = pPlane1 = 0
|
||||||
|
jointIndex = LeftHandIndex4 = 59
|
||||||
|
jointIndex = RightShoulder = 20
|
||||||
|
jointIndex = Spine = 16
|
||||||
|
jointIndex = Neck = 68
|
||||||
|
jointIndex = joint = 19
|
||||||
|
jointIndex = RightUpLeg = 6
|
||||||
|
jointIndex = LeftHandIndex1 = 56
|
||||||
|
jointIndex = LeftHandMiddle1 = 64
|
||||||
|
jointIndex = RightHandPinky1 = 36
|
||||||
|
jointIndex = Head = 69
|
||||||
|
jointIndex = LeftHandThumb2 = 61
|
||||||
|
jointIndex = RightHandMiddle1 = 40
|
||||||
|
jointIndex = LeftHandPinky3 = 50
|
||||||
|
jointIndex = LeftFoot = 13
|
||||||
|
jointIndex = LeftHandMiddle2 = 65
|
||||||
|
jointIndex = cloud = 1
|
||||||
|
jointIndex = LeftHandRing2 = 53
|
||||||
|
jointIndex = LeftHandMiddle3 = 66
|
||||||
|
jointIndex = LeftHand = 47
|
||||||
|
jointIndex = RightHandThumb1 = 24
|
||||||
|
jointIndex = LeftLeg = 12
|
||||||
|
jointIndex = RightEye = 71
|
||||||
|
jointIndex = RightHandThumb4 = 27
|
||||||
|
jointIndex = LeftHandPinky4 = 51
|
BIN
hifi-content/alexia/Avatars/HappyCloud/CloudHappy/CloudHappy.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/HappyCloud/CloudHappy/CloudHappy.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/Avatars/HappyCloud/cloudAvatarHappy.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/HappyCloud/cloudAvatarHappy.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/Avatars/HappyCloud/rainbow.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/HappyCloud/rainbow.png
(Stored with Git LFS)
Normal file
Binary file not shown.
67
hifi-content/alexia/Avatars/HappyCloud/rainbowParticles.js
Normal file
67
hifi-content/alexia/Avatars/HappyCloud/rainbowParticles.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
Entities.addEntity({
|
||||||
|
"accelerationSpread": {
|
||||||
|
"x": 0.009999999776482582,
|
||||||
|
"y": 0.009999999776482582,
|
||||||
|
"z": 0.009999999776482582
|
||||||
|
},
|
||||||
|
parentID: MyAvatar.sessionUUID,
|
||||||
|
"alpha": 1,
|
||||||
|
"clientOnly": true,
|
||||||
|
"colorSpread": {
|
||||||
|
"blue": 255,
|
||||||
|
"green": 255,
|
||||||
|
"red": 255
|
||||||
|
},
|
||||||
|
"dimensions": {
|
||||||
|
"x": 2.630753517150879,
|
||||||
|
"y": 2.630753517150879,
|
||||||
|
"z": 2.630753517150879
|
||||||
|
},
|
||||||
|
"emitAcceleration": {
|
||||||
|
"x": -0.0010000000474974513,
|
||||||
|
"y": -1,
|
||||||
|
"z": -0.0010000000474974513
|
||||||
|
},
|
||||||
|
"emitDimensions": {
|
||||||
|
"x": 2,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"emitOrientation": {
|
||||||
|
"w": 0.9961956143379211,
|
||||||
|
"x": 0.08714515715837479,
|
||||||
|
"y": -1.525894731457811e-05,
|
||||||
|
"z": -1.525894731457811e-05
|
||||||
|
},
|
||||||
|
"emitterShouldTrail": true,
|
||||||
|
"emitRate": 5,
|
||||||
|
"emitSpeed": 0.1,
|
||||||
|
"lastEdited": 1523663549048249,
|
||||||
|
"lastEditedBy": "{7493705d-dd55-4110-a7f7-15c53d24425f}",
|
||||||
|
"lifespan": 0.9999979019165,
|
||||||
|
"maxParticles": 300,
|
||||||
|
"owningAvatarID": "{00000000-0000-0000-0000-000000000000}",
|
||||||
|
"particleRadius": 0.15,
|
||||||
|
"polarFinish": 3.1415927410125732,
|
||||||
|
"queryAACube": {
|
||||||
|
"scale": 4.556598663330078,
|
||||||
|
"x": -2.278299331665039,
|
||||||
|
"y": -2.278299331665039,
|
||||||
|
"z": -2.278299331665039
|
||||||
|
},
|
||||||
|
"radiusFinish": 0.15,
|
||||||
|
"radiusSpread": 0.15,
|
||||||
|
"radiusStart": 0.15,
|
||||||
|
"rotation": {
|
||||||
|
"w": -0.7054398059844971,
|
||||||
|
"x": -1.52587890625e-05,
|
||||||
|
"y": 0.7087968587875366,
|
||||||
|
"z": -1.52587890625e-05
|
||||||
|
},
|
||||||
|
"speedSpread": 0,
|
||||||
|
localPosition: Vec3.ZERO,
|
||||||
|
localRotation: Quat.IDENTITY,
|
||||||
|
"textures": "http://hifi-content.s3.amazonaws.com/alexia/Avatars/HappyCloud/rainbow.png",
|
||||||
|
"type": "ParticleEffect",
|
||||||
|
"userData": "{\"grabbableKey\":{\"grabbable\":false}}"
|
||||||
|
}, true);
|
92
hifi-content/alexia/Avatars/Stormcloud/cloud.fst
Normal file
92
hifi-content/alexia/Avatars/Stormcloud/cloud.fst
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
name = cloud
|
||||||
|
type = body+head
|
||||||
|
scale = 1
|
||||||
|
filename = cloud/cloud.fbx
|
||||||
|
script = http://hifi-content.s3.amazonaws.com/alexia/Avatars/Stormcloud/rainParticles.js
|
||||||
|
script = http://hifi-content.s3.amazonaws.com/alexia/Avatars/Stormcloud/lightningParticles.js
|
||||||
|
texdir = cloud/textures
|
||||||
|
joint = jointRoot = Hips
|
||||||
|
joint = jointEyeRight = RightEye
|
||||||
|
joint = jointRightHand = RightHand
|
||||||
|
joint = jointLeftHand = LeftHand
|
||||||
|
joint = jointHead = Head
|
||||||
|
joint = jointLean = Spine
|
||||||
|
joint = jointEyeLeft = LeftEye
|
||||||
|
joint = jointNeck = Neck
|
||||||
|
freeJoint = LeftArm
|
||||||
|
freeJoint = LeftForeArm
|
||||||
|
freeJoint = RightArm
|
||||||
|
freeJoint = RightForeArm
|
||||||
|
jointIndex = RightFoot = 8
|
||||||
|
jointIndex = Spine1 = 17
|
||||||
|
jointIndex = RightUpLeg = 6
|
||||||
|
jointIndex = LeftHandPinky1 = 48
|
||||||
|
jointIndex = RightHandRing1 = 32
|
||||||
|
jointIndex = Spine2 = 18
|
||||||
|
jointIndex = MeshGroup = 4
|
||||||
|
jointIndex = RightArm = 21
|
||||||
|
jointIndex = RightShoulder = 20
|
||||||
|
jointIndex = RightHandIndex2 = 29
|
||||||
|
jointIndex = LeftHand = 47
|
||||||
|
jointIndex = LeftHandThumb3 = 62
|
||||||
|
jointIndex = RightHandPinky2 = 37
|
||||||
|
jointIndex = LeftHandRing2 = 53
|
||||||
|
jointIndex = RightHandMiddle3 = 42
|
||||||
|
jointIndex = RightHandThumb4 = 27
|
||||||
|
jointIndex = LeftHandPinky3 = 50
|
||||||
|
jointIndex = LeftHandThumb2 = 61
|
||||||
|
jointIndex = pPlane1 = 0
|
||||||
|
jointIndex = RightHandThumb2 = 25
|
||||||
|
jointIndex = RightHandIndex4 = 31
|
||||||
|
jointIndex = LeftShoulder = 44
|
||||||
|
jointIndex = LeftHandMiddle4 = 67
|
||||||
|
jointIndex = RightEye = 71
|
||||||
|
jointIndex = Hips = 5
|
||||||
|
jointIndex = LeftHandMiddle2 = 65
|
||||||
|
jointIndex = LeftEye = 70
|
||||||
|
jointIndex = LeftHandThumb1 = 60
|
||||||
|
jointIndex = RightHand = 23
|
||||||
|
jointIndex = LeftHandThumb4 = 63
|
||||||
|
jointIndex = RightLeg = 7
|
||||||
|
jointIndex = LeftToeBase = 14
|
||||||
|
jointIndex = LeftHandMiddle1 = 64
|
||||||
|
jointIndex = LeftHandMiddle3 = 66
|
||||||
|
jointIndex = LeftToe_End = 15
|
||||||
|
jointIndex = joint = 19
|
||||||
|
jointIndex = RightHandRing3 = 34
|
||||||
|
jointIndex = LeftHandIndex4 = 59
|
||||||
|
jointIndex = RightHandRing4 = 35
|
||||||
|
jointIndex = RightHandThumb1 = 24
|
||||||
|
jointIndex = LeftFoot = 13
|
||||||
|
jointIndex = LeftArm = 45
|
||||||
|
jointIndex = polySurface4 = 2
|
||||||
|
jointIndex = Neck = 68
|
||||||
|
jointIndex = LeftHandIndex2 = 57
|
||||||
|
jointIndex = LeftUpLeg = 11
|
||||||
|
jointIndex = RightHandMiddle2 = 41
|
||||||
|
jointIndex = RightHandMiddle4 = 43
|
||||||
|
jointIndex = LeftHandPinky4 = 51
|
||||||
|
jointIndex = LeftHandPinky2 = 49
|
||||||
|
jointIndex = RightHandPinky3 = 38
|
||||||
|
jointIndex = polySurface2 = 3
|
||||||
|
jointIndex = cloud = 1
|
||||||
|
jointIndex = RightHandMiddle1 = 40
|
||||||
|
jointIndex = LeftHandIndex3 = 58
|
||||||
|
jointIndex = RightToeBase = 9
|
||||||
|
jointIndex = LeftHandRing1 = 52
|
||||||
|
jointIndex = LeftForeArm = 46
|
||||||
|
jointIndex = LeftLeg = 12
|
||||||
|
jointIndex = Head = 69
|
||||||
|
jointIndex = RightHandPinky4 = 39
|
||||||
|
jointIndex = LeftHandRing4 = 55
|
||||||
|
jointIndex = LeftHandRing3 = 54
|
||||||
|
jointIndex = RightHandPinky1 = 36
|
||||||
|
jointIndex = RightHandIndex1 = 28
|
||||||
|
jointIndex = RightHandThumb3 = 26
|
||||||
|
jointIndex = RightForeArm = 22
|
||||||
|
jointIndex = Spine = 16
|
||||||
|
jointIndex = RightHandIndex3 = 30
|
||||||
|
jointIndex = RightToe_End = 10
|
||||||
|
jointIndex = HeadTop_End = 72
|
||||||
|
jointIndex = RightHandRing2 = 33
|
||||||
|
jointIndex = LeftHandIndex1 = 56
|
BIN
hifi-content/alexia/Avatars/Stormcloud/cloud/cloud.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Stormcloud/cloud/cloud.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
1
hifi-content/alexia/Avatars/Stormcloud/cloud/textures/Cloud.jpg
Symbolic link
1
hifi-content/alexia/Avatars/Stormcloud/cloud/textures/Cloud.jpg
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../../Cloud/Cloud/textures/Cloud.jpg
|
BIN
hifi-content/alexia/Avatars/Stormcloud/cloud/textures/angryFace.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Stormcloud/cloud/textures/angryFace.png
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
hifi-content/alexia/Avatars/Stormcloud/lightning.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Stormcloud/lightning.png
(Stored with Git LFS)
Normal file
Binary file not shown.
89
hifi-content/alexia/Avatars/Stormcloud/lightningParticles.js
Normal file
89
hifi-content/alexia/Avatars/Stormcloud/lightningParticles.js
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
// lightningParticles.js
|
||||||
|
//
|
||||||
|
// Created by Alexia Mandeville on 30 Apr 2018
|
||||||
|
// al@alexiamandeville.com
|
||||||
|
//
|
||||||
|
// A script to briefly show particles parented to my avatar in High Fidelity on keypress
|
||||||
|
// To run the script, Edit > Running Scripts > Load the script here
|
||||||
|
// When input is provided, I show my lightning particles, parent to my avatar
|
||||||
|
//
|
||||||
|
// High Fidelity docs: https://docs.highfidelity.com/
|
||||||
|
//
|
||||||
|
|
||||||
|
Controller.keyPressEvent.connect(function (event) { // More info: https://docs.highfidelity.com/api-reference/namespaces/controller
|
||||||
|
|
||||||
|
//When I press the L key, show my lightning briefly
|
||||||
|
if(event.text === "l"){
|
||||||
|
AddEntity(); // Create the entity
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function AddEntity(){
|
||||||
|
Entities.addEntity({ // More info:https://docs.highfidelity.com/api-reference/namespaces/entities
|
||||||
|
"accelerationSpread": {
|
||||||
|
"x": 0.009999999776482582,
|
||||||
|
"y": 0.009999999776482582,
|
||||||
|
"z": 0.009999999776482582
|
||||||
|
},
|
||||||
|
"lifetime": 1, //Make sure the entity only shows for a small time
|
||||||
|
parentID: MyAvatar.sessionUUID,
|
||||||
|
"alpha": 1,
|
||||||
|
"clientOnly": true,
|
||||||
|
"colorSpread": {
|
||||||
|
"blue": 255,
|
||||||
|
"green": 255,
|
||||||
|
"red": 255
|
||||||
|
},
|
||||||
|
"dimensions": {
|
||||||
|
"x": 2.630753517150879,
|
||||||
|
"y": 2.630753517150879,
|
||||||
|
"z": 2.630753517150879
|
||||||
|
},
|
||||||
|
"emitAcceleration": {
|
||||||
|
"x": -0.0010000000474974513,
|
||||||
|
"y": -1,
|
||||||
|
"z": -0.0010000000474974513
|
||||||
|
},
|
||||||
|
"emitDimensions": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"emitOrientation": {
|
||||||
|
"w": 0.9961956143379211,
|
||||||
|
"x": 0.08714515715837479,
|
||||||
|
"y": -1.5,
|
||||||
|
"z": -1.0
|
||||||
|
},
|
||||||
|
"emitRate": 5,
|
||||||
|
"emitSpeed": 0.1,
|
||||||
|
"lastEdited": 1523663549048249,
|
||||||
|
"lastEditedBy": "{7493705d-dd55-4110-a7f7-15c53d24425f}",
|
||||||
|
"lifespan": 0.91999979019165,
|
||||||
|
"maxParticles": 2,
|
||||||
|
"owningAvatarID": "{00000000-0000-0000-0000-000000000000}",
|
||||||
|
"particleRadius": 0.8,
|
||||||
|
"polarFinish": 3.1415927410125732,
|
||||||
|
"queryAACube": {
|
||||||
|
"scale": 4.556598663330078,
|
||||||
|
"x": -2.278299331665039,
|
||||||
|
"y": -2.278299331665039,
|
||||||
|
"z": -2.278299331665039
|
||||||
|
},
|
||||||
|
"radiusFinish": 0.8,
|
||||||
|
"radiusSpread": 0.8,
|
||||||
|
"radiusStart": 0.8,
|
||||||
|
"rotation": {
|
||||||
|
"w": -0.7054398059844971,
|
||||||
|
"x": -1.52587890625e-05,
|
||||||
|
"y": 0.7087968587875366,
|
||||||
|
"z": -1.52587890625e-05
|
||||||
|
},
|
||||||
|
"speedSpread": 0,
|
||||||
|
localPosition: Vec3.ZERO,
|
||||||
|
localRotation: Quat.IDENTITY,
|
||||||
|
"textures": "http://hifi-content.s3.amazonaws.com/alexia/Avatars/Stormcloud/lightning.png",
|
||||||
|
"type": "ParticleEffect",
|
||||||
|
"userData": "{\"grabbableKey\":{\"grabbable\":false}}"
|
||||||
|
}, true);
|
||||||
|
}
|
67
hifi-content/alexia/Avatars/Stormcloud/rainParticles.js
Normal file
67
hifi-content/alexia/Avatars/Stormcloud/rainParticles.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
Entities.addEntity({
|
||||||
|
"accelerationSpread": {
|
||||||
|
"x": 0.009999999776482582,
|
||||||
|
"y": 0.009999999776482582,
|
||||||
|
"z": 0.009999999776482582
|
||||||
|
},
|
||||||
|
parentID: MyAvatar.sessionUUID,
|
||||||
|
"alpha": 1,
|
||||||
|
"clientOnly": true,
|
||||||
|
"colorSpread": {
|
||||||
|
"blue": 255,
|
||||||
|
"green": 255,
|
||||||
|
"red": 255
|
||||||
|
},
|
||||||
|
"dimensions": {
|
||||||
|
"x": 2.630753517150879,
|
||||||
|
"y": 2.630753517150879,
|
||||||
|
"z": 2.630753517150879
|
||||||
|
},
|
||||||
|
"emitAcceleration": {
|
||||||
|
"x": -0.0010000000474974513,
|
||||||
|
"y": -1,
|
||||||
|
"z": -0.0010000000474974513
|
||||||
|
},
|
||||||
|
"emitDimensions": {
|
||||||
|
"x": 2,
|
||||||
|
"y": 0,
|
||||||
|
"z": 0
|
||||||
|
},
|
||||||
|
"emitOrientation": {
|
||||||
|
"w": 0.9961956143379211,
|
||||||
|
"x": 0.08714515715837479,
|
||||||
|
"y": -1.525894731457811e-05,
|
||||||
|
"z": -1.525894731457811e-05
|
||||||
|
},
|
||||||
|
"emitterShouldTrail": true,
|
||||||
|
"emitRate": 5,
|
||||||
|
"emitSpeed": 0.1,
|
||||||
|
"lastEdited": 1523663549048249,
|
||||||
|
"lastEditedBy": "{7493705d-dd55-4110-a7f7-15c53d24425f}",
|
||||||
|
"lifespan": 3.21999979019165,
|
||||||
|
"maxParticles": 300,
|
||||||
|
"owningAvatarID": "{00000000-0000-0000-0000-000000000000}",
|
||||||
|
"particleRadius": 0.15,
|
||||||
|
"polarFinish": 3.1415927410125732,
|
||||||
|
"queryAACube": {
|
||||||
|
"scale": 4.556598663330078,
|
||||||
|
"x": -2.278299331665039,
|
||||||
|
"y": -2.278299331665039,
|
||||||
|
"z": -2.278299331665039
|
||||||
|
},
|
||||||
|
"radiusFinish": 0.15,
|
||||||
|
"radiusSpread": 0.15,
|
||||||
|
"radiusStart": 0.15,
|
||||||
|
"rotation": {
|
||||||
|
"w": -0.7054398059844971,
|
||||||
|
"x": -1.52587890625e-05,
|
||||||
|
"y": 0.7087968587875366,
|
||||||
|
"z": -1.52587890625e-05
|
||||||
|
},
|
||||||
|
"speedSpread": 0,
|
||||||
|
localPosition: Vec3.ZERO,
|
||||||
|
localRotation: Quat.IDENTITY,
|
||||||
|
"textures": "http://hifi-content.s3.amazonaws.com/alexia/Avatars/Stormcloud/raindrop.png",
|
||||||
|
"type": "ParticleEffect",
|
||||||
|
"userData": "{\"grabbableKey\":{\"grabbable\":false}}"
|
||||||
|
}, true);
|
BIN
hifi-content/alexia/Avatars/Stormcloud/raindrop.png
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/Stormcloud/raindrop.png
(Stored with Git LFS)
Normal file
Binary file not shown.
89
hifi-content/alexia/Avatars/theHand/theHand.fst
Normal file
89
hifi-content/alexia/Avatars/theHand/theHand.fst
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
name = theHand
|
||||||
|
type = body+head
|
||||||
|
scale = 1
|
||||||
|
filename = theHand/theHand.fbx
|
||||||
|
texdir = theHand/textures
|
||||||
|
joint = jointEyeRight = RightEye
|
||||||
|
joint = jointLean = Spine
|
||||||
|
joint = jointHead = Head
|
||||||
|
joint = jointEyeLeft = LeftEye
|
||||||
|
joint = jointRoot = Hips
|
||||||
|
joint = jointRightHand = RightHand
|
||||||
|
joint = jointNeck = Neck
|
||||||
|
joint = jointLeftHand = LeftHand
|
||||||
|
freeJoint = LeftArm
|
||||||
|
freeJoint = LeftForeArm
|
||||||
|
freeJoint = RightArm
|
||||||
|
freeJoint = RightForeArm
|
||||||
|
jointIndex = RightFoot = 7
|
||||||
|
jointIndex = LeftHandMiddle1 = 62
|
||||||
|
jointIndex = Spine = 15
|
||||||
|
jointIndex = RightHandPinky1 = 34
|
||||||
|
jointIndex = RightHandMiddle2 = 39
|
||||||
|
jointIndex = LeftHandIndex4 = 57
|
||||||
|
jointIndex = RightHandThumb1 = 22
|
||||||
|
jointIndex = RightToeBase = 8
|
||||||
|
jointIndex = RightHandRing1 = 30
|
||||||
|
jointIndex = Spine2 = 17
|
||||||
|
jointIndex = RightEye = 69
|
||||||
|
jointIndex = RightHandIndex4 = 29
|
||||||
|
jointIndex = RightHandIndex3 = 28
|
||||||
|
jointIndex = Head = 67
|
||||||
|
jointIndex = RightShoulder = 18
|
||||||
|
jointIndex = LeftArm = 43
|
||||||
|
jointIndex = LeftForeArm = 44
|
||||||
|
jointIndex = transform1 = 2
|
||||||
|
jointIndex = RightHandMiddle1 = 38
|
||||||
|
jointIndex = polySurface5 = 0
|
||||||
|
jointIndex = LeftToeBase = 13
|
||||||
|
jointIndex = LeftHand = 45
|
||||||
|
jointIndex = LeftHandThumb1 = 58
|
||||||
|
jointIndex = LeftHandThumb3 = 60
|
||||||
|
jointIndex = LeftHandPinky3 = 48
|
||||||
|
jointIndex = RightHandThumb4 = 25
|
||||||
|
jointIndex = RightForeArm = 20
|
||||||
|
jointIndex = LeftHandIndex2 = 55
|
||||||
|
jointIndex = RightArm = 19
|
||||||
|
jointIndex = RightHandIndex2 = 27
|
||||||
|
jointIndex = RightHandRing4 = 33
|
||||||
|
jointIndex = LeftHandPinky2 = 47
|
||||||
|
jointIndex = RightHandRing3 = 32
|
||||||
|
jointIndex = Spine1 = 16
|
||||||
|
jointIndex = Hips = 4
|
||||||
|
jointIndex = LeftLeg = 11
|
||||||
|
jointIndex = LeftHandIndex3 = 56
|
||||||
|
jointIndex = Neck = 66
|
||||||
|
jointIndex = LeftHandIndex1 = 54
|
||||||
|
jointIndex = RightToe_End = 9
|
||||||
|
jointIndex = LeftToe_End = 14
|
||||||
|
jointIndex = RightHandThumb2 = 23
|
||||||
|
jointIndex = LeftHandPinky4 = 49
|
||||||
|
jointIndex = RightHand = 21
|
||||||
|
jointIndex = RightHandRing2 = 31
|
||||||
|
jointIndex = Sun = 3
|
||||||
|
jointIndex = LeftHandMiddle2 = 63
|
||||||
|
jointIndex = RightHandPinky4 = 37
|
||||||
|
jointIndex = LeftUpLeg = 10
|
||||||
|
jointIndex = LeftShoulder = 42
|
||||||
|
jointIndex = LeftHandRing1 = 50
|
||||||
|
jointIndex = RightUpLeg = 5
|
||||||
|
jointIndex = LeftHandRing3 = 52
|
||||||
|
jointIndex = RightHandThumb3 = 24
|
||||||
|
jointIndex = LeftHandMiddle3 = 64
|
||||||
|
jointIndex = surface_PLY = 1
|
||||||
|
jointIndex = RightHandMiddle4 = 41
|
||||||
|
jointIndex = RightHandPinky3 = 36
|
||||||
|
jointIndex = LeftHandThumb4 = 61
|
||||||
|
jointIndex = LeftEye = 68
|
||||||
|
jointIndex = LeftHandPinky1 = 46
|
||||||
|
jointIndex = RightLeg = 6
|
||||||
|
jointIndex = LeftFoot = 12
|
||||||
|
jointIndex = RightHandPinky2 = 35
|
||||||
|
jointIndex = LeftHandThumb2 = 59
|
||||||
|
jointIndex = HeadTop_End = 70
|
||||||
|
jointIndex = RightHandIndex1 = 26
|
||||||
|
jointIndex = LeftHandRing4 = 53
|
||||||
|
jointIndex = LeftHandRing2 = 51
|
||||||
|
jointIndex = RightHandMiddle3 = 40
|
||||||
|
jointIndex = LeftHandMiddle4 = 65
|
||||||
|
jointIndex = Plane005 = 71
|
BIN
hifi-content/alexia/Avatars/theHand/theHand/theHand.fbx
(Stored with Git LFS)
Normal file
BIN
hifi-content/alexia/Avatars/theHand/theHand/theHand.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
|
@ -0,0 +1,42 @@
|
||||||
|
name = watermelonKing
|
||||||
|
type = body+head
|
||||||
|
scale = 0.7
|
||||||
|
filename = watermelonKing/watermelonKing.fbx
|
||||||
|
texdir = watermelonKing/textures
|
||||||
|
joint = jointLean = Spine
|
||||||
|
joint = jointNeck = Neck
|
||||||
|
joint = jointRoot = Hips
|
||||||
|
joint = jointEyeLeft = LeftEye
|
||||||
|
joint = jointHead = Head
|
||||||
|
joint = jointRightHand = RightHand
|
||||||
|
joint = jointLeftHand = LeftHand
|
||||||
|
joint = jointEyeRight = RightEye
|
||||||
|
freeJoint = LeftArm
|
||||||
|
freeJoint = LeftForeArm
|
||||||
|
freeJoint = RightArm
|
||||||
|
freeJoint = RightForeArm
|
||||||
|
jointIndex = LeftUpLeg = 6
|
||||||
|
jointIndex = RightUpLeg = 3
|
||||||
|
jointIndex = RightShoulder = 12
|
||||||
|
jointIndex = LeftFoot = 8
|
||||||
|
jointIndex = LeftLeg = 7
|
||||||
|
jointIndex = RightLeg = 4
|
||||||
|
jointIndex = Hips = 2
|
||||||
|
jointIndex = LeftArm = 17
|
||||||
|
jointIndex = LeftEye = 22
|
||||||
|
jointIndex = RightArm = 13
|
||||||
|
jointIndex = RightEye = 23
|
||||||
|
jointIndex = LeftShoulder = 16
|
||||||
|
jointIndex = HeadTop_End = 24
|
||||||
|
jointIndex = LeftHand = 19
|
||||||
|
jointIndex = Neck = 20
|
||||||
|
jointIndex = LeftForeArm = 18
|
||||||
|
jointIndex = Spine2 = 11
|
||||||
|
jointIndex = RightForeArm = 14
|
||||||
|
jointIndex = Spine = 9
|
||||||
|
jointIndex = Head = 21
|
||||||
|
jointIndex = group4 = 0
|
||||||
|
jointIndex = group5 = 1
|
||||||
|
jointIndex = RightFoot = 5
|
||||||
|
jointIndex = Spine1 = 10
|
||||||
|
jointIndex = RightHand = 15
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue