mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-15 19:56:55 +02:00
merge
This commit is contained in:
commit
cf66cd42ed
9 changed files with 254 additions and 902 deletions
|
@ -1,739 +0,0 @@
|
|||
(function() {
|
||||
|
||||
var utilsPath = Script.resolvePath("../utils.js");
|
||||
Script.include(utilsPath);
|
||||
var avatarModelURL = 'https://s3.amazonaws.com/hifi-public/ozan/avatars/albert/albert/albert.fbx';
|
||||
|
||||
DressingRoom = function() {
|
||||
return this
|
||||
}
|
||||
|
||||
DressingRoom.prototype = {
|
||||
preload: function(entityID) {
|
||||
print('PRELOAD DRESSING ROOM');
|
||||
this.entityID = entityID;
|
||||
// avatarModelURL = getAvatarFBX();
|
||||
},
|
||||
enterEntity: function() {
|
||||
print('ENTER DRESSING ROOM');
|
||||
// avatarModelURL = getAvatarFBX();
|
||||
makeDoppelgangerForMyAvatar();
|
||||
subscribeToWearableMessages();
|
||||
// subscribeToFreezeMessages();
|
||||
createWearable();
|
||||
this.setOccupied();
|
||||
var doppelProps = Entities.getEntityProperties(this.entityID);
|
||||
Script.setTimeout(function() {
|
||||
Entities.editEntity(doppelgangers[0], {
|
||||
dimensions: doppelProps.naturalDimensions,
|
||||
});
|
||||
}, 1000)
|
||||
|
||||
},
|
||||
leaveEntity: function() {
|
||||
print('EXIT DRESSING ROOM!');
|
||||
this.setUnoccupied();
|
||||
cleanup();
|
||||
},
|
||||
checkIfOccupied: function() {
|
||||
var data = getEntityCustomData('hifi-home-dressing-room', this.entityID, {
|
||||
occupied: false
|
||||
});
|
||||
return data.occupied;
|
||||
},
|
||||
setOccupied: function() {
|
||||
setEntityCustomData('hifi-home-dressing-room', this.entityID, {
|
||||
occupied: true
|
||||
});
|
||||
},
|
||||
setUnoccupied: function() {
|
||||
setEntityCustomData('hifi-home-dressing-room', this.entityID, {
|
||||
occupied: false
|
||||
});
|
||||
},
|
||||
unload: function() {
|
||||
this.setUnoccupied();
|
||||
cleanup();
|
||||
},
|
||||
};
|
||||
|
||||
//
|
||||
// doppelganger.js
|
||||
//
|
||||
// Created by James B. Pollack @imgntn on 12/28/2015
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// This script shows how to hook up a model entity to your avatar to act as a doppelganger.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var MIRROR_JOINT_DATA = true;
|
||||
var MIRRORED_ENTITY_SCRIPT_URL = Script.resolvePath('mirroredEntity.js');
|
||||
var FREEZE_TOGGLER_SCRIPT_URL = Script.resolvePath('freezeToggler.js?' + Math.random(0, 1000))
|
||||
var THROTTLE = false;
|
||||
var THROTTLE_RATE = 100;
|
||||
var doppelgangers = [];
|
||||
|
||||
|
||||
function Doppelganger(avatar) {
|
||||
this.initialProperties = {
|
||||
name: 'Hifi-Doppelganger',
|
||||
type: 'Model',
|
||||
modelURL: avatarModelURL,
|
||||
// dimensions: getAvatarDimensions(avatar),
|
||||
position: matchBasePosition(),
|
||||
rotation: matchBaseRotation(),
|
||||
collisionsWillMove: false,
|
||||
ignoreForCollisions: false,
|
||||
// script: FREEZE_TOGGLER_SCRIPT_URL,
|
||||
userData: JSON.stringify({
|
||||
grabbableKey: {
|
||||
grabbable: false,
|
||||
wantsTrigger: true
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
this.id = createDoppelgangerEntity(this.initialProperties);
|
||||
this.avatar = avatar;
|
||||
return this;
|
||||
}
|
||||
|
||||
function getAvatarFBX() {
|
||||
var skeletonURL = MyAvatar.skeletonModelURL;
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("GET", skeletonURL, false);
|
||||
req.send();
|
||||
|
||||
var fst = req.responseText;
|
||||
|
||||
var fbxURL;
|
||||
|
||||
var split = fst.split('\n');
|
||||
split.forEach(function(line) {
|
||||
if (line.indexOf('filename') > -1) {
|
||||
var innerSplit = line.split(" ");
|
||||
innerSplit.forEach(function(inner) {
|
||||
if (inner.indexOf('.fbx') > -1) {
|
||||
fbxURL = inner;
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
return fbxURL
|
||||
}
|
||||
|
||||
function getJointData(avatar) {
|
||||
var allJointData = [];
|
||||
var jointNames = MyAvatar.jointNames;
|
||||
jointNames.forEach(function(joint, index) {
|
||||
var translation = MyAvatar.getJointTranslation(index);
|
||||
var rotation = MyAvatar.getJointRotation(index)
|
||||
allJointData.push({
|
||||
joint: joint,
|
||||
index: index,
|
||||
translation: translation,
|
||||
rotation: rotation
|
||||
});
|
||||
});
|
||||
|
||||
return allJointData;
|
||||
}
|
||||
|
||||
function setJointData(doppelganger, relativeXforms) {
|
||||
print('setting joint data for ' + doppelganger.id)
|
||||
var jointRotations = [];
|
||||
var i, l = relativeXforms.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
jointRotations.push(relativeXforms[i].rot);
|
||||
}
|
||||
var setJointSuccess = Entities.setAbsoluteJointRotationsInObjectFrame(doppelganger.id, jointRotations);
|
||||
// print('JOINT ROTATIONS:: ' + JSON.stringify(jointRotations));
|
||||
print('SUCCESS SETTING JOINTS?' + setJointSuccess + "for " + doppelganger.id)
|
||||
return;
|
||||
}
|
||||
|
||||
// maps joint names to their mirrored joint
|
||||
var JOINT_MIRROR_NAME_MAP = {
|
||||
RightUpLeg: "LeftUpLeg",
|
||||
RightLeg: "LeftLeg",
|
||||
RightFoot: "LeftFoot",
|
||||
LeftUpLeg: "RightUpLeg",
|
||||
LeftLeg: "RightLeg",
|
||||
LeftFoot: "RightFoot",
|
||||
RightShoulder: "LeftShoulder",
|
||||
RightArm: "LeftArm",
|
||||
RightForeArm: "LeftForeArm",
|
||||
RightHand: "LeftHand",
|
||||
RightHandThumb1: "LeftHandThumb1",
|
||||
RightHandThumb2: "LeftHandThumb2",
|
||||
RightHandThumb3: "LeftHandThumb3",
|
||||
RightHandThumb4: "LeftHandThumb4",
|
||||
RightHandIndex1: "LeftHandIndex1",
|
||||
RightHandIndex2: "LeftHandIndex2",
|
||||
RightHandIndex3: "LeftHandIndex3",
|
||||
RightHandIndex4: "LeftHandIndex4",
|
||||
RightHandMiddle1: "LeftHandMiddle1",
|
||||
RightHandMiddle2: "LeftHandMiddle2",
|
||||
RightHandMiddle3: "LeftHandMiddle3",
|
||||
RightHandMiddle4: "LeftHandMiddle4",
|
||||
RightHandRing1: "LeftHandRing1",
|
||||
RightHandRing2: "LeftHandRing2",
|
||||
RightHandRing3: "LeftHandRing3",
|
||||
RightHandRing4: "LeftHandRing4",
|
||||
RightHandPinky1: "LeftHandPinky1",
|
||||
RightHandPinky2: "LeftHandPinky2",
|
||||
RightHandPinky3: "LeftHandPinky3",
|
||||
RightHandPinky4: "LeftHandPinky4",
|
||||
LeftShoulder: "RightShoulder",
|
||||
LeftArm: "RightArm",
|
||||
LeftForeArm: "RightForeArm",
|
||||
LeftHand: "RightHand",
|
||||
LeftHandThumb1: "RightHandThumb1",
|
||||
LeftHandThumb2: "RightHandThumb2",
|
||||
LeftHandThumb3: "RightHandThumb3",
|
||||
LeftHandThumb4: "RightHandThumb4",
|
||||
LeftHandIndex1: "RightHandIndex1",
|
||||
LeftHandIndex2: "RightHandIndex2",
|
||||
LeftHandIndex3: "RightHandIndex3",
|
||||
LeftHandIndex4: "RightHandIndex4",
|
||||
LeftHandMiddle1: "RightHandMiddle1",
|
||||
LeftHandMiddle2: "RightHandMiddle2",
|
||||
LeftHandMiddle3: "RightHandMiddle3",
|
||||
LeftHandMiddle4: "RightHandMiddle4",
|
||||
LeftHandRing1: "RightHandRing1",
|
||||
LeftHandRing2: "RightHandRing2",
|
||||
LeftHandRing3: "RightHandRing3",
|
||||
LeftHandRing4: "RightHandRing4",
|
||||
LeftHandPinky1: "RightHandPinky1",
|
||||
LeftHandPinky2: "RightHandPinky2",
|
||||
LeftHandPinky3: "RightHandPinky3",
|
||||
LeftHandPinky4: "RightHandPinky4",
|
||||
LeftHandPinky: "RightHandPinky",
|
||||
};
|
||||
|
||||
// maps joint names to parent joint names.
|
||||
var JOINT_PARENT_NAME_MAP = {
|
||||
Hips: "",
|
||||
RightUpLeg: "Hips",
|
||||
RightLeg: "RightUpLeg",
|
||||
RightFoot: "RightLeg",
|
||||
LeftUpLeg: "Hips",
|
||||
LeftLeg: "LeftUpLeg",
|
||||
LeftFoot: "LeftLeg",
|
||||
Spine: "Hips",
|
||||
Spine1: "Spine",
|
||||
Spine2: "Spine1",
|
||||
Spine3: "Spine2",
|
||||
Neck: "Spine3",
|
||||
Head: "Neck",
|
||||
RightShoulder: "Spine3",
|
||||
RightArm: "RightShoulder",
|
||||
RightForeArm: "RightArm",
|
||||
RightHand: "RightForeArm",
|
||||
RightHandThumb1: "RightHand",
|
||||
RightHandThumb2: "RightHandThumb1",
|
||||
RightHandThumb3: "RightHandThumb2",
|
||||
RightHandThumb4: "RightHandThumb3",
|
||||
RightHandIndex1: "RightHand",
|
||||
RightHandIndex2: "RightHandIndex1",
|
||||
RightHandIndex3: "RightHandIndex2",
|
||||
RightHandIndex4: "RightHandIndex3",
|
||||
RightHandMiddle1: "RightHand",
|
||||
RightHandMiddle2: "RightHandMiddle1",
|
||||
RightHandMiddle3: "RightHandMiddle2",
|
||||
RightHandMiddle4: "RightHandMiddle3",
|
||||
RightHandRing1: "RightHand",
|
||||
RightHandRing2: "RightHandRing1",
|
||||
RightHandRing3: "RightHandRing2",
|
||||
RightHandRing4: "RightHandRing3",
|
||||
RightHandPinky1: "RightHand",
|
||||
RightHandPinky2: "RightHandPinky1",
|
||||
RightHandPinky3: "RightHandPinky2",
|
||||
RightHandPinky4: "RightHandPinky3",
|
||||
LeftShoulder: "Spine3",
|
||||
LeftArm: "LeftShoulder",
|
||||
LeftForeArm: "LeftArm",
|
||||
LeftHand: "LeftForeArm",
|
||||
LeftHandThumb1: "LeftHand",
|
||||
LeftHandThumb2: "LeftHandThumb1",
|
||||
LeftHandThumb3: "LeftHandThumb2",
|
||||
LeftHandThumb4: "LeftHandThumb3",
|
||||
LeftHandIndex1: "LeftHand",
|
||||
LeftHandIndex2: "LeftHandIndex1",
|
||||
LeftHandIndex3: "LeftHandIndex2",
|
||||
LeftHandIndex4: "LeftHandIndex3",
|
||||
LeftHandMiddle1: "LeftHand",
|
||||
LeftHandMiddle2: "LeftHandMiddle1",
|
||||
LeftHandMiddle3: "LeftHandMiddle2",
|
||||
LeftHandMiddle4: "LeftHandMiddle3",
|
||||
LeftHandRing1: "LeftHand",
|
||||
LeftHandRing2: "LeftHandRing1",
|
||||
LeftHandRing3: "LeftHandRing2",
|
||||
LeftHandRing4: "LeftHandRing3",
|
||||
LeftHandPinky1: "LeftHand",
|
||||
LeftHandPinky2: "LeftHandPinky1",
|
||||
LeftHandPinky3: "LeftHandPinky2",
|
||||
LeftHandPinky: "LeftHandPinky3",
|
||||
};
|
||||
|
||||
// maps joint indices to parent joint indices.
|
||||
var JOINT_PARENT_INDEX_MAP;
|
||||
var JOINT_MIRROR_INDEX_MAP;
|
||||
|
||||
// ctor
|
||||
function Xform(rot, pos) {
|
||||
this.rot = rot;
|
||||
this.pos = pos;
|
||||
};
|
||||
Xform.ident = function() {
|
||||
return new Xform({
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0,
|
||||
w: 1
|
||||
}, {
|
||||
x: 0,
|
||||
y: 0,
|
||||
z: 0
|
||||
});
|
||||
}
|
||||
Xform.mul = function(lhs, rhs) {
|
||||
var rot = Quat.multiply(lhs.rot, rhs.rot);
|
||||
var pos = Vec3.sum(lhs.pos, Vec3.multiplyQbyV(lhs.rot, rhs.pos));
|
||||
return new Xform(rot, pos);
|
||||
};
|
||||
Xform.prototype.inv = function() {
|
||||
var invRot = Quat.inverse(this.rot);
|
||||
var invPos = Vec3.multiply(-1, this.pos);
|
||||
return new Xform(invRot, Vec3.multiplyQbyV(invRot, invPos));
|
||||
};
|
||||
Xform.prototype.mirrorX = function() {
|
||||
return new Xform({
|
||||
x: this.rot.x,
|
||||
y: -this.rot.y,
|
||||
z: -this.rot.z,
|
||||
w: this.rot.w
|
||||
}, {
|
||||
x: -this.pos.x,
|
||||
y: this.pos.y,
|
||||
z: this.pos.z
|
||||
});
|
||||
}
|
||||
Xform.prototype.toString = function() {
|
||||
var rot = this.rot;
|
||||
var pos = this.pos;
|
||||
return "Xform rot = (" + rot.x + ", " + rot.y + ", " + rot.z + ", " + rot.w + "), pos = (" + pos.x + ", " + pos.y + ", " + pos.z + ")";
|
||||
};
|
||||
|
||||
function buildAbsoluteXformsFromMyAvatar() {
|
||||
var jointNames = MyAvatar.getJointNames();
|
||||
|
||||
// lazy init of JOINT_PARENT_INDEX_MAP
|
||||
if (jointNames.length > 0 && !JOINT_PARENT_INDEX_MAP) {
|
||||
JOINT_PARENT_INDEX_MAP = {};
|
||||
var keys = Object.keys(JOINT_PARENT_NAME_MAP);
|
||||
var i, l = keys.length;
|
||||
var keyIndex, valueName, valueIndex;
|
||||
for (i = 0; i < l; i++) {
|
||||
keyIndex = MyAvatar.getJointIndex(keys[i]);
|
||||
valueName = JOINT_PARENT_NAME_MAP[keys[i]];
|
||||
if (valueName) {
|
||||
valueIndex = MyAvatar.getJointIndex(valueName);
|
||||
} else {
|
||||
valueIndex = -1;
|
||||
}
|
||||
JOINT_PARENT_INDEX_MAP[keyIndex] = valueIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// lazy init of JOINT_MIRROR_INDEX_MAP
|
||||
if (jointNames.length > 0 && !JOINT_MIRROR_INDEX_MAP) {
|
||||
JOINT_MIRROR_INDEX_MAP = {};
|
||||
var keys = Object.keys(JOINT_MIRROR_NAME_MAP);
|
||||
var i, l = keys.length;
|
||||
var keyIndex, valueName, valueIndex;
|
||||
for (i = 0; i < l; i++) {
|
||||
keyIndex = MyAvatar.getJointIndex(keys[i]);
|
||||
valueIndex = MyAvatar.getJointIndex(JOINT_MIRROR_NAME_MAP[keys[i]]);
|
||||
if (valueIndex > 0) {
|
||||
JOINT_MIRROR_INDEX_MAP[keyIndex] = valueIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// build absolute xforms by multiplying by parent Xforms
|
||||
var absoluteXforms = [];
|
||||
var i, l = jointNames.length;
|
||||
var parentXform;
|
||||
for (i = 0; i < l; i++) {
|
||||
var parentIndex = JOINT_PARENT_INDEX_MAP[i];
|
||||
if (parentIndex >= 0) {
|
||||
parentXform = absoluteXforms[parentIndex];
|
||||
} else {
|
||||
parentXform = Xform.ident();
|
||||
}
|
||||
var localXform = new Xform(MyAvatar.getJointRotation(i), MyAvatar.getJointTranslation(i));
|
||||
absoluteXforms.push(Xform.mul(parentXform, localXform));
|
||||
}
|
||||
return absoluteXforms;
|
||||
}
|
||||
|
||||
function buildRelativeXformsFromAbsoluteXforms(absoluteXforms) {
|
||||
|
||||
// build relative xforms by multiplying by the inverse of the parent Xforms
|
||||
var relativeXforms = [];
|
||||
var i, l = absoluteXforms.length;
|
||||
var parentXform;
|
||||
for (i = 0; i < l; i++) {
|
||||
var parentIndex = JOINT_PARENT_INDEX_MAP[i];
|
||||
if (parentIndex >= 0) {
|
||||
parentXform = absoluteXforms[parentIndex];
|
||||
} else {
|
||||
parentXform = Xform.ident();
|
||||
}
|
||||
relativeXforms.push(Xform.mul(parentXform.inv(), absoluteXforms[i]));
|
||||
}
|
||||
return relativeXforms;
|
||||
}
|
||||
|
||||
function createDoppelganger(avatar) {
|
||||
return new Doppelganger(avatar);
|
||||
}
|
||||
|
||||
function createDoppelgangerEntity(initialProperties) {
|
||||
return Entities.addEntity(initialProperties);
|
||||
}
|
||||
|
||||
function matchBasePosition() {
|
||||
var ids = Entities.findEntities(MyAvatar.position, 20);
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
var entityID = ids[i];
|
||||
var props = Entities.getEntityProperties(entityID, "name");
|
||||
var name = props.name;
|
||||
if (name === "Hifi-Dressing-Room-Base") {
|
||||
var details = Entities.getEntityProperties(entityID, ["position", "dimensions"]);
|
||||
details.position.y += getAvatarFootOffset();
|
||||
details.position.y += details.dimensions.y / 2;
|
||||
print('JBP BASE POSITION ' + JSON.stringify(details.position))
|
||||
return details.position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function getAvatarFootOffset() {
|
||||
var data = getJointData();
|
||||
var upperLeg, lowerLeg, foot, toe, toeTop;
|
||||
data.forEach(function(d) {
|
||||
|
||||
var jointName = d.joint;
|
||||
if (jointName === "RightUpLeg") {
|
||||
upperLeg = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightLeg") {
|
||||
lowerLeg = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightFoot") {
|
||||
foot = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightToeBase") {
|
||||
toe = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightToe_End") {
|
||||
toeTop = d.translation.y
|
||||
}
|
||||
})
|
||||
|
||||
var myPosition = MyAvatar.position;
|
||||
var offset = upperLeg + lowerLeg + foot + toe + toeTop;
|
||||
offset = offset / 100;
|
||||
return offset
|
||||
}
|
||||
|
||||
function matchBaseRotation() {
|
||||
var ids = Entities.findEntities(MyAvatar.position, 20);
|
||||
var hasBase = false;
|
||||
for (var i = 0; i < ids.length; i++) {
|
||||
var entityID = ids[i];
|
||||
var props = Entities.getEntityProperties(entityID, "name");
|
||||
var name = props.name;
|
||||
if (name === "Hifi-Dressing-Room-Base") {
|
||||
var details = Entities.getEntityProperties(entityID, "rotation");
|
||||
print('JBP DOPPELGANGER ROTATION SET TO BASE:: ' + JSON.stringify(details.rotation))
|
||||
return details.rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function connectDoppelgangerUpdates() {
|
||||
Script.update.connect(updateDoppelganger);
|
||||
|
||||
}
|
||||
|
||||
function disconnectDoppelgangerUpdates() {
|
||||
Script.update.disconnect(updateDoppelganger);
|
||||
}
|
||||
|
||||
var sinceLastUpdate = 0;
|
||||
|
||||
function updateDoppelganger(deltaTime) {
|
||||
if (THROTTLE === true) {
|
||||
sinceLastUpdate = sinceLastUpdate + deltaTime * 100;
|
||||
if (sinceLastUpdate > THROTTLE_RATE) {
|
||||
sinceLastUpdate = 0;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var absoluteXforms = buildAbsoluteXformsFromMyAvatar();
|
||||
if (MIRROR_JOINT_DATA) {
|
||||
var mirroredAbsoluteXforms = [];
|
||||
var i, l = absoluteXforms.length;
|
||||
for (i = 0; i < l; i++) {
|
||||
var mirroredIndex = JOINT_MIRROR_INDEX_MAP[i];
|
||||
if (mirroredIndex === undefined) {
|
||||
mirroredIndex = i;
|
||||
}
|
||||
mirroredAbsoluteXforms[mirroredIndex] = absoluteXforms[i].mirrorX();
|
||||
}
|
||||
absoluteXforms = mirroredAbsoluteXforms;
|
||||
}
|
||||
var relativeXforms = buildRelativeXformsFromAbsoluteXforms(absoluteXforms);
|
||||
// print('DOPPELGANGERS:::: ' + doppelgangers.length);
|
||||
// print('first doppel id:: ' + doppelgangers[0].id);
|
||||
doppelgangers.forEach(function(doppelganger) {
|
||||
setJointData(doppelganger, relativeXforms);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function makeDoppelgangerForMyAvatar() {
|
||||
doppelgangers = [];
|
||||
var doppelganger = createDoppelganger(MyAvatar);
|
||||
doppelgangers.push(doppelganger);
|
||||
connectDoppelgangerUpdates();
|
||||
}
|
||||
|
||||
// function subscribeToWearableMessages() {
|
||||
// Messages.subscribe('Hifi-Doppelganger-Wearable');
|
||||
// Messages.messageReceived.connect(handleWearableMessages);
|
||||
// }
|
||||
|
||||
function subscribeToFreezeMessages() {
|
||||
Messages.subscribe('Hifi-Doppelganger-Freeze');
|
||||
Messages.messageReceived.connect(handleFreezeMessages);
|
||||
}
|
||||
|
||||
function handleFreezeMessages(channel, message, sender) {
|
||||
if (channel !== 'Hifi-Doppelganger-Freeze') {
|
||||
return;
|
||||
}
|
||||
if (sender !== MyAvatar.sessionUUID) {
|
||||
return;
|
||||
}
|
||||
|
||||
var parsedMessage = null;
|
||||
|
||||
try {
|
||||
parsedMessage = JSON.parse(message);
|
||||
} catch (e) {
|
||||
print('error parsing wearable message');
|
||||
}
|
||||
print('MESSAGE ACTION::' + parsedMessage.action)
|
||||
if (parsedMessage.action === 'freeze') {
|
||||
print('ACTUAL FREEZE')
|
||||
disconnectDoppelgangerUpdates();
|
||||
}
|
||||
if (parsedMessage.action === 'unfreeze') {
|
||||
print('ACTUAL UNFREEZE')
|
||||
connectDoppelgangerUpdates();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var wearablePairs = [];
|
||||
|
||||
|
||||
|
||||
// function getMirrorEntityForBaseEntity(baseEntity) {
|
||||
// var result = wearablePairs.filter(function(obj) {
|
||||
// return obj.baseEntity === baseEntity;
|
||||
// });
|
||||
// if (result.length === 0) {
|
||||
// return false;
|
||||
// } else {
|
||||
// return result[0].mirrorEntity
|
||||
// }
|
||||
// }
|
||||
|
||||
// function getBaseEntityForMirrorEntity(mirrorEntity) {
|
||||
// var result = wearablePairs.filter(function(obj) {
|
||||
// return obj.mirrorEntity === mirrorEntity;
|
||||
// });
|
||||
// if (result.length === 0) {
|
||||
// return false;
|
||||
// } else {
|
||||
// return result[0].baseEntity
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
var wearable;
|
||||
|
||||
function createWearable() {
|
||||
var WEARABLE_POSITION = {
|
||||
x: 1107.5726,
|
||||
y: 460.4974,
|
||||
z: -77.0471
|
||||
}
|
||||
var properties = {
|
||||
type: 'Model',
|
||||
modelURL: 'https://s3.amazonaws.com/hifi-public/tony/cowboy-hat.fbx',
|
||||
name: 'Hifi-Wearable',
|
||||
dimensions: {
|
||||
x: 0.25,
|
||||
y: 0.25,
|
||||
z: 0.25
|
||||
},
|
||||
color: {
|
||||
red: 0,
|
||||
green: 255,
|
||||
blue: 0
|
||||
},
|
||||
position: WEARABLE_POSITION,
|
||||
userData: JSON.stringify({
|
||||
"grabbableKey": {
|
||||
"invertSolidWhileHeld": false
|
||||
},
|
||||
"wearable": {
|
||||
"joints": ["head", "Head", "hair", "neck"]
|
||||
},
|
||||
handControllerKey: {
|
||||
disableReleaseVelocity: true,
|
||||
disableMoveWithHead: true,
|
||||
}
|
||||
})
|
||||
}
|
||||
wearable = Entities.addEntity(properties);
|
||||
}
|
||||
|
||||
|
||||
function updateEntityOnAvatar(entityOnAvatar, entityOnDoppelganger) {
|
||||
//this updates an entity on the avatar when you move one on the doppelganger.
|
||||
|
||||
//copy doppelganger entity properties to avatar but replace its parent with our avatar id. delete some things before we do that
|
||||
|
||||
var entityOnAvatarProps = Entities.getEntityProperties(entityOnDoppelganger)
|
||||
|
||||
delete entityOnAvatarProps.id;
|
||||
delete entityOnAvatarProps.created;
|
||||
delete entityOnAvatarProps.age;
|
||||
delete entityOnAvatarProps.ageAsText;
|
||||
|
||||
entityOnAvatarProps.parentID = MyAvatar.id;
|
||||
Entities.editEntity(entityOnAvatar, entityOnAvatarProps);
|
||||
}
|
||||
|
||||
function removeEntityFromAvatar(entityOnAvatar) {
|
||||
Entities.deleteEntity(entityOnAvatar);
|
||||
}
|
||||
|
||||
function addEntityToDoppelganger(entityToAdd,bestJointIndex) {
|
||||
|
||||
var entityToAddProps = Entities.getEntityProperties(entityToAdd);
|
||||
|
||||
entityToAddProps.parentID = doppelgangers[0].id;
|
||||
entityToAddProps.parentJointIndex =bestJointIndex;
|
||||
Entities.addEntity(entityToAddProps);
|
||||
|
||||
}
|
||||
|
||||
function updateEntityOnDoppelganger(entityOnAvatar, entityOnDoppelganger) {
|
||||
//this updates an entity on the doppelganger when you move one on the avatar.
|
||||
|
||||
//copy avatar entity properties to doppelganger but replace its parent with our doppelganger id. delete some things before we do that
|
||||
|
||||
var entityOnDoppelgangerProps = Entities.getEntityProperties(entityOnAvatar)
|
||||
|
||||
delete entityOnDoppelgangerProps.id;
|
||||
delete entityOnDoppelgangerProps.created;
|
||||
delete entityOnDoppelgangerProps.age;
|
||||
delete entityOnDoppelgangerProps.ageAsText;
|
||||
|
||||
entityOnDoppelgangerProps.parentID = doppelgangers[0].id;
|
||||
Entities.editEntity(entityOnDoppelganger, entityOnDoppelgangerProps);
|
||||
|
||||
}
|
||||
|
||||
function removeEntityFromDoppelganger(entityOnDoppelganger) {
|
||||
Entities.deleteEntity(entityOnDoppelganger);
|
||||
}
|
||||
|
||||
function checkIfWearableOnDoppelganger(grabbedEntity) {
|
||||
// when you drop an entity near a doppelganger...
|
||||
var allowedJoints = getEntityCustomData('wearable', grabbedEntity, DEFAULT_WEARABLE_DATA).joints;
|
||||
|
||||
var props = Entities.getEntityProperties(grabbedEntity, ["position", "parentID"]);
|
||||
//if the thing doesn't have a parent
|
||||
if (props.parentID === NULL_UUID) {
|
||||
var bestJointName = "";
|
||||
var bestJointIndex = -1;
|
||||
var bestJointDistance = 0;
|
||||
for (var jointName in allowedJoints) {
|
||||
//do this for the model
|
||||
var jointIndex = Entities.getJointIndex(doppelganger.id, jointName);
|
||||
var jointPosition = Entities.getJointPosition(doppelganger.id, jointIndex);
|
||||
var distanceFromJoint = Vec3.distance(jointPosition, props.position);
|
||||
if (distanceFromJoint < 0.4) {
|
||||
if (bestJointIndex == -1 || distanceFromJoint < bestJointDistance) {
|
||||
bestJointName = jointName;
|
||||
bestJointIndex = jointIndex;
|
||||
bestJointDistance = distanceFromJoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bestJointIndex !== -1) {
|
||||
//this was dropped close to a valid joint on the doppelganger.
|
||||
addEntityToDoppelganger(grabbedEntity,bestJointIndex)
|
||||
} else {
|
||||
//this was dropped far from a valid joint on the doppelganger
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleReleaseMessagesFromGrabScript() {
|
||||
var grabbedEntity;
|
||||
checkIfWearableOnDoppelganger(grabbedEntity);
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
|
||||
Script.update.disconnect(updateDoppelganger);
|
||||
|
||||
doppelgangers.forEach(function(doppelganger) {
|
||||
print('DELETING DOPPELGANGER' + doppelganger.id)
|
||||
Entities.deleteEntity(doppelganger.id);
|
||||
});
|
||||
|
||||
doppelgangers = [];
|
||||
|
||||
//temporarily
|
||||
Entities.deleteEntity(wearable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new DressingRoom();
|
||||
});
|
|
@ -1,74 +0,0 @@
|
|||
//
|
||||
// dopppelgangerEntity.js
|
||||
//
|
||||
// Created by James B. Pollack @imgntn on 1/6/2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// for freezing / unfreezing the doppelganger
|
||||
//
|
||||
// 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 COUNTDOWN_LENGTH = 0;
|
||||
var _this;
|
||||
|
||||
Dopppelganger = function() {
|
||||
|
||||
_this = this;
|
||||
};
|
||||
|
||||
Dopppelganger.prototype = {
|
||||
isFrozen: false,
|
||||
startNearTrigger: function() {
|
||||
print('DOPPELGANGER NEAR TRIGGER')
|
||||
},
|
||||
startFarTrigger: function() {
|
||||
print('DOPPELGANGER FAR TRIGGER')
|
||||
if (this.isFrozen === false) {
|
||||
this.freeze();
|
||||
} else {
|
||||
this.unfreeze();
|
||||
}
|
||||
|
||||
},
|
||||
clickReleaseOnEntity: function(entityID, mouseEvent) {
|
||||
print('DOPPELGANGER CLICK')
|
||||
if (!mouseEvent.isLeftButton) {
|
||||
return;
|
||||
}
|
||||
if (this.isFrozen === false) {
|
||||
this.freeze();
|
||||
} else {
|
||||
this.unfreeze();
|
||||
}
|
||||
|
||||
},
|
||||
freeze: function() {
|
||||
print('FREEZE YO')
|
||||
this.isFrozen = true;
|
||||
var data = {
|
||||
action: 'freeze'
|
||||
}
|
||||
|
||||
Script.setTimeout(function() {
|
||||
Messages.sendMessage('Hifi-Doppelganger-Freeze', JSON.stringify(data));
|
||||
}, COUNTDOWN_LENGTH)
|
||||
|
||||
},
|
||||
unfreeze: function() {
|
||||
this.isFrozen = false;
|
||||
var data = {
|
||||
action: 'unfreeze'
|
||||
}
|
||||
Messages.sendMessage('Hifi-Doppelganger-Freeze', JSON.stringify(data));
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
},
|
||||
};
|
||||
|
||||
return new Dopppelganger();
|
||||
})
|
|
@ -1,48 +0,0 @@
|
|||
//
|
||||
// mirroredEntity.js
|
||||
//
|
||||
// Created by James B. Pollack @imgntn on 1/6/2016
|
||||
// Copyright 2016 High Fidelity, Inc.
|
||||
//
|
||||
// when grabbed, this entity relays updates to update the base entity
|
||||
//
|
||||
// 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;
|
||||
|
||||
MirroredEntity = function() {
|
||||
_this = this;
|
||||
};
|
||||
|
||||
MirroredEntity.prototype = {
|
||||
startNearGrab: function () {
|
||||
print("I was just grabbed... entity:" + this.entityID);
|
||||
},
|
||||
continueNearGrab: function () {
|
||||
print("I am still being grabbed... entity:" + this.entityID);
|
||||
var data = {
|
||||
action:'updateBase',
|
||||
baseEntity:this.userData.doppelgangerKey.baseEntity,
|
||||
mirrorEntity:this.entityID,
|
||||
doppelganger:this.userData.doppelgangerKey.doppelganger
|
||||
}
|
||||
Messages.sendMessage('Hifi-Doppelganger-Wearable',data)
|
||||
},
|
||||
|
||||
releaseGrab: function () {
|
||||
print("I was released... entity:" + this.entityID);
|
||||
},
|
||||
|
||||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
this.initialProperties = Entities.getEntityProperties(this.entityID);
|
||||
this.userData = JSON.parse(this.initialProperties.userData);
|
||||
},
|
||||
};
|
||||
|
||||
return new MirroredEntity();
|
||||
})
|
|
@ -0,0 +1,165 @@
|
|||
// when you drop a doll and it hits the dressing room platform it transforms into a big version.
|
||||
// the small doll is destroyed and a new small doll is put on the shelf
|
||||
|
||||
|
||||
(function() {
|
||||
var TRIGGER_DISTANCE = 0.25;
|
||||
var TRANSFORMATION_SOUND_URL = '';
|
||||
|
||||
function Transformer() {
|
||||
return this;
|
||||
}
|
||||
|
||||
Transformer.prototype = {
|
||||
rotatorBlock: null,
|
||||
transformationSound: null,
|
||||
preload: function(entityID) {
|
||||
this.entityID = entityID;
|
||||
this.initialProperties = Entities.getEntityProperties(entityID);
|
||||
this.transformationSound = SoundCache.getSound(TRANSFORMATION_SOUND_URL);
|
||||
},
|
||||
|
||||
collisionWithEntity: function(myID, otherID, collisionInfo) {
|
||||
var otherProps = Entities.getEntityProperties(otherID);
|
||||
if (otherProps.name = "hifi-home-dressing-room-transformer-collider") {
|
||||
// this.playTransformationSound(collisionInfo.contactPoint);
|
||||
// this.createTransformationParticles();
|
||||
this.findRotatorBlock();
|
||||
}
|
||||
},
|
||||
|
||||
playTransformationSound: function(position) {
|
||||
Audio.playSound(this.transformationSound, {
|
||||
position: position,
|
||||
volume: 0.5
|
||||
});
|
||||
},
|
||||
|
||||
createTransformationParticles: function() {
|
||||
var particleProps = {};
|
||||
Entities.addEntity(particleProps);
|
||||
},
|
||||
|
||||
findRotatorBlock: function() {
|
||||
var myProps = Entities.getEntityProperties(this.entityID);
|
||||
var results = Entities.findEntities(myProps.position, 10);
|
||||
results.forEach(function(result) {
|
||||
var resultProps = Entities.getEntityProperties(result);
|
||||
if (resultProps.name === "hifi-home-dressing-room-rotator-block") {
|
||||
this.rotatorBlock = result;
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
removeCurrentBigVersion: function() {
|
||||
var myProps = Entities.getEntityProperties(this.entityID);
|
||||
var results = Entities.findEntities(myProps.position, 10);
|
||||
results.forEach(function(result) {
|
||||
var resultProps = Entities.getEntityProperties(result);
|
||||
if (resultProps.name === "hifi-home-dressing-room-big-transformer") {
|
||||
Entities.deleteEntity(result)
|
||||
}
|
||||
});
|
||||
|
||||
this.createBigVersion(myProps);
|
||||
},
|
||||
|
||||
createBigVersion: function(smallProps) {
|
||||
var rotatorProps = Entities.getEntityProperties(this.rotatorBlock);
|
||||
var bigVersionProps = {
|
||||
name: "hifi-home-dressing-room-big-transformer",
|
||||
type: 'Model',
|
||||
parentID: this.rotatorBlock,
|
||||
modelURL: smallProps.modelURL,
|
||||
position: this.putTransformerOnRotatorBlock(rotatorProps.position),
|
||||
rotation: rotatorProps.rotation,
|
||||
userData: JSON.stringify({
|
||||
'grabbableKey': {
|
||||
'grabbable:', false
|
||||
},
|
||||
'hifiHomeKey': {
|
||||
'reset': true
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
Entities.addEntity(bigVersionProps);
|
||||
this.putNewVersionOnShelf();
|
||||
},
|
||||
|
||||
putTransformerOnRotatorBlock: function(blockPosition) {
|
||||
var myProps = Entities.getEntityProperties(this.entityID);
|
||||
var halfHeight = myProps.dimensions.y / 2;
|
||||
var newPosition = {
|
||||
x: blockPosition.x,
|
||||
y: blockPosition.x + halfHeight,
|
||||
z: blockPosition.z
|
||||
}
|
||||
|
||||
return newPosition
|
||||
},
|
||||
|
||||
putNewVersionOnShelf: function() {
|
||||
var littleVersionProps = Entities.getEntityProperties(this.entityID);
|
||||
var userData = JSON.parse(littleVersionProps.userData);
|
||||
var basePosition = userData["hifiHomeTransformerKey"].basePosition;
|
||||
littleVersionProps.position = basePosition;
|
||||
Entities.addEntity(littleVersionProps);
|
||||
this.removeSelf();
|
||||
},
|
||||
|
||||
removeSelf: function() {
|
||||
Entities.deleteEntity(this.entityID);
|
||||
},
|
||||
};
|
||||
|
||||
function getJointData(avatar) {
|
||||
//can you do this for an arbitrary model?
|
||||
var allJointData = [];
|
||||
var jointNames = MyAvatar.jointNames;
|
||||
jointNames.forEach(function(joint, index) {
|
||||
var translation = MyAvatar.getJointTranslation(index);
|
||||
var rotation = MyAvatar.getJointRotation(index)
|
||||
allJointData.push({
|
||||
joint: joint,
|
||||
index: index,
|
||||
translation: translation,
|
||||
rotation: rotation
|
||||
});
|
||||
});
|
||||
|
||||
return allJointData;
|
||||
}
|
||||
|
||||
function getAvatarFootOffset() {
|
||||
var data = getJointData();
|
||||
var upperLeg, lowerLeg, foot, toe, toeTop;
|
||||
data.forEach(function(d) {
|
||||
|
||||
var jointName = d.joint;
|
||||
if (jointName === "RightUpLeg") {
|
||||
upperLeg = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightLeg") {
|
||||
lowerLeg = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightFoot") {
|
||||
foot = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightToeBase") {
|
||||
toe = d.translation.y;
|
||||
}
|
||||
if (jointName === "RightToe_End") {
|
||||
toeTop = d.translation.y
|
||||
}
|
||||
})
|
||||
|
||||
var myPosition = MyAvatar.position;
|
||||
var offset = upperLeg + lowerLeg + foot + toe + toeTop;
|
||||
offset = offset / 100;
|
||||
return offset
|
||||
}
|
||||
|
||||
return new Transformer();
|
||||
})
|
|
@ -0,0 +1,28 @@
|
|||
function TransformerDoll(modelURL, spawnPosition, spawnRotation) {
|
||||
var transformerProps = {
|
||||
name: 'hifi-home-dressing-room-little-transformer',
|
||||
type: 'model',
|
||||
position: spawnPosition,
|
||||
rotation: spawnRotation,
|
||||
modelURL: modelURL,
|
||||
dynamic: true,
|
||||
gravity: {
|
||||
x: 0,
|
||||
y: -5,
|
||||
z: 0
|
||||
},
|
||||
userData: JSON.stringify({
|
||||
'grabbableKey': {
|
||||
'grabbable:', true
|
||||
},
|
||||
'hifiHomeTransformerKey': {
|
||||
'basePosition': spawnPosition
|
||||
},
|
||||
'hifiHomeKey': {
|
||||
'reset': true
|
||||
}
|
||||
}),
|
||||
}
|
||||
Entities.addEntity(transformerProps);
|
||||
return this;
|
||||
}
|
|
@ -114,7 +114,7 @@
|
|||
dynamic: true,
|
||||
rotation: gunProperties.rotation,
|
||||
position: this.getGunTipPosition(gunProperties),
|
||||
gravity:PING_PONG_GUN_GRAVITY,
|
||||
gravity: PING_PONG_GUN_GRAVITY,
|
||||
velocity: forwardVec,
|
||||
lifetime: 10,
|
||||
userData: JSON.stringify({
|
||||
|
|
|
@ -15,7 +15,7 @@ var MODEL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.
|
|||
var COLLISION_HULL_URL = 'http://hifi-content.s3.amazonaws.com/alan/dev/Pingpong-Gun-New.obj';
|
||||
var COLLISION_SOUND_URL = 'http://hifi-public.s3.amazonaws.com/sounds/Collisions-otherorganic/plastic_impact.L.wav';
|
||||
|
||||
_PingPongGun = function(spawnPosition, spawnRotation) {
|
||||
HomePingPongGun = function(spawnPosition, spawnRotation) {
|
||||
var pingPongGun = Entities.addEntity({
|
||||
type: "Model",
|
||||
modelURL: MODEL_URL,
|
||||
|
@ -28,10 +28,10 @@ _PingPongGun = function(spawnPosition, spawnRotation) {
|
|||
y: 0.3875,
|
||||
z: 0.9931
|
||||
},
|
||||
gravity:{
|
||||
x:0,
|
||||
y:-3,
|
||||
z:0
|
||||
gravity: {
|
||||
x: 0,
|
||||
y: -3,
|
||||
z: 0
|
||||
},
|
||||
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
|
||||
dynamic: true,
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
var utilsPath = Script.resolvePath('utils.js');
|
||||
|
||||
var kineticPath = Script.resolvePath("kineticObjects/wrapper.js?" + Math.random());
|
||||
|
||||
var fishTankPath = Script.resolvePath('fishTank/wrapper.js?' + Math.random());
|
||||
|
||||
var tiltMazePath = Script.resolvePath("tiltMaze/wrapper.js?" + Math.random())
|
||||
|
@ -30,27 +32,27 @@
|
|||
|
||||
var cuckooClockPath = Script.resolvePath("cuckooClock/wrapper.js?" + Math.random());
|
||||
|
||||
|
||||
var pingPongGunPath = Script.resolvePath("pingPongGun/wrapper.js?" + Math.random());
|
||||
|
||||
var kineticPath = Script.resolvePath("kineticObjects/wrapper.js?" + Math.random());
|
||||
var transformerPath = Script.resolvePath("dressingRoom/wrapper.js?" + Math.random());
|
||||
|
||||
Script.include(utilsPath);
|
||||
|
||||
Script.include(kineticPath);
|
||||
|
||||
Script.include(utilsPath);
|
||||
Script.include(fishTankPath);
|
||||
Script.include(tiltMazePath);
|
||||
Script.include(whiteboardPath);
|
||||
Script.include(plantPath);
|
||||
Script.include(cuckooClockPath);
|
||||
|
||||
Script.include(pingPongGunPath);
|
||||
Script.include(transformerPath);
|
||||
|
||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
||||
x: 0,
|
||||
y: 0.5,
|
||||
z: 0
|
||||
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
||||
var TRANSFORMER_URL_ARTEMIS = 'http://hifi-public.s3.amazonaws.com/ryan/DefaultAvatarFemale2/0314HiFiFemAviHeightChange.fbx';
|
||||
var TRANSFORMER_URL_ALBERT = 'https://s3.amazonaws.com/hifi-public/ozan/avatars/albert/albert/albert.fbx';
|
||||
var TRANSFORMER_URL_BEING_OF_LIGHT = 'http://hifi-public.s3.amazonaws.com/ryan/0318HiFiBoL/0318HiFiBoL.fbx';
|
||||
var TRANSFORMER_URL_KATE = 'https://hifi-public.s3.amazonaws.com/ozan/avatars/kate/kate/kate.fbx';
|
||||
var TRANSFORMER_URL_WILL = 'https://s3.amazonaws.com/hifi-public/models/skeletons/Will/Will.fbx';
|
||||
|
||||
Reset.prototype = {
|
||||
tidying: false,
|
||||
|
@ -98,6 +100,7 @@
|
|||
Script.setTimeout(function() {
|
||||
_this.createKineticEntities();
|
||||
_this.createDynamicEntities();
|
||||
_this.createTransformers();
|
||||
}, 750)
|
||||
|
||||
|
||||
|
@ -156,7 +159,7 @@
|
|||
z: 0
|
||||
});
|
||||
|
||||
var pingPongGun = new _PingPongGun({
|
||||
var pingPongGun = new HomePingPongGun({
|
||||
x: 1101.2123,
|
||||
y: 460.2328,
|
||||
z: -65.8513
|
||||
|
@ -244,15 +247,15 @@
|
|||
});
|
||||
|
||||
var cellPoster = new PosterCell({
|
||||
x:1103.78,
|
||||
y:461,
|
||||
z:-70.3
|
||||
x: 1103.78,
|
||||
y: 461,
|
||||
z: -70.3
|
||||
});
|
||||
|
||||
var playaPoster = new PosterPlaya({
|
||||
x:1101.8,
|
||||
y:461,
|
||||
z:-73.3
|
||||
x: 1101.8,
|
||||
y: 461,
|
||||
z: -73.3
|
||||
});
|
||||
|
||||
|
||||
|
@ -264,6 +267,39 @@
|
|||
|
||||
},
|
||||
|
||||
createTransformers: function() {
|
||||
var firstDollPosition: {
|
||||
x: 1108.2123,
|
||||
y: 460.7516,
|
||||
z: -80.9387
|
||||
}
|
||||
|
||||
var dollRotation = {
|
||||
x: 0,
|
||||
y: 28,
|
||||
z: 0,
|
||||
}
|
||||
|
||||
var dolls = [
|
||||
TRANSFORMER_URL_ARTEMIS,
|
||||
TRANSFORMER_URL_ALBERT,
|
||||
TRANSFORMER_URL_BEING_OF_LIGHT,
|
||||
TRANSFORMER_URL_KATE,
|
||||
TRANSFORMER_URL_WILL
|
||||
];
|
||||
|
||||
var dollLateralSeparation = 0.5;
|
||||
dolls.forEach(function(doll, index) {
|
||||
var separation = index * dollLateralSeparation;
|
||||
var right = Quat.getRight(dollRotation);
|
||||
var left = Vec3.multiply(-1, right);
|
||||
var howFarLeft = Vec3.multiply(separation, left);
|
||||
var distanceToLeft = Vec3.sum(firstDollPosition, howFarLeft);
|
||||
var transformer = new TransformerDoll(doll, distanceToLeft, dollRotation);
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
findAndDeleteHomeEntities: function() {
|
||||
print('JBP trying to find home entities to delete')
|
||||
var resetProperties = Entities.getEntityProperties(_this.entityID);
|
||||
|
@ -289,10 +325,11 @@
|
|||
})
|
||||
print('JBP after deleting home entities')
|
||||
},
|
||||
|
||||
unload: function() {
|
||||
this.findAndDeleteHomeEntities();
|
||||
// this.findAndDeleteHomeEntities();
|
||||
}
|
||||
|
||||
}
|
||||
return new Reset();
|
||||
});
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
hifi-home-living-room-disc-light-model
|
||||
hifi-home-living-room-disc-light-glow
|
||||
hifi-home-living-room-disc-light-master
|
||||
|
||||
hifi-home-living-room-ceiling-fan
|
||||
hifi-home-living-room-ceiling-fan-sound
|
||||
hifi-home-living-room-vent-sound
|
||||
|
||||
hifi-home-living-room-desk-lamp-trigger
|
||||
hifi-home-living-room-desk-lamp-spotlight
|
||||
|
||||
hifi-home-lab-desk-lamp-trigger
|
||||
hifi-home-lab-desk-lamp-spotlight
|
||||
|
||||
hifi-home-dressing-room-disc-light-model
|
||||
hifi-home-dressing-room-disc-light-glow
|
||||
hifi-home-dressing-room-disc-light-master
|
Loading…
Reference in a new issue