mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 19:04:27 +02:00
start transformer, remove doppelganger, various cleanup
This commit is contained in:
parent
5708d2e6f0
commit
f34e17fdea
7 changed files with 59 additions and 868 deletions
|
@ -1,706 +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();
|
|
||||||
this.setOccupied();
|
|
||||||
var doppelProps = Entities.getEntityProperties(this.entityID);
|
|
||||||
// Entities.editEntity(doppelgangers[0], {
|
|
||||||
// dimensions: doppelProps.naturalDimensions,
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
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 handleWearableMessages(channel, message, sender) {
|
|
||||||
if (channel !== 'Hifi-Doppelganger-Wearable' || 'Hifi-Doppelganger-Wearable-Avatar') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sender !== MyAvatar.sessionUUID) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var parsedMessage = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
parsedMessage = JSON.parse(message);
|
|
||||||
} catch (e) {
|
|
||||||
print('error parsing wearable message');
|
|
||||||
}
|
|
||||||
print('parsed message!!!')
|
|
||||||
|
|
||||||
if (channel === 'Hifi-Doppelganger-Wearable') {
|
|
||||||
mirrorEntitiesForDoppelganger(doppelgangers[0], parsedMessage);
|
|
||||||
}
|
|
||||||
if (channel === 'Hifi-Doppelganger-Wearable') {
|
|
||||||
mirrorEntitiesForAvatar(parsedMessge);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function mirrorEntitiesForDoppelganger(doppelganger, parsedMessage) {
|
|
||||||
var doppelgangerProps = Entities.getEntityProperties(doppelganger.id);
|
|
||||||
|
|
||||||
var action = parsedMessage.action;
|
|
||||||
print('IN MIRROR ENTITIES CALL' + action)
|
|
||||||
|
|
||||||
var baseEntity = parsedMessage.baseEntity;
|
|
||||||
|
|
||||||
var wearableProps = Entities.getEntityProperties(baseEntity);
|
|
||||||
|
|
||||||
print('WEARABLE PROPS::')
|
|
||||||
delete wearableProps.id;
|
|
||||||
delete wearableProps.created;
|
|
||||||
delete wearableProps.age;
|
|
||||||
delete wearableProps.ageAsText;
|
|
||||||
//delete wearableProps.position;
|
|
||||||
// add to dg
|
|
||||||
// add to avatar
|
|
||||||
// moved item on dg
|
|
||||||
// moved item on avatar
|
|
||||||
// remove item from dg
|
|
||||||
// remove item from avatar
|
|
||||||
|
|
||||||
var joint = wearableProps.parentJointIndex;
|
|
||||||
if (action === 'add') {
|
|
||||||
print('IN DOPPELGANGER ADD');
|
|
||||||
|
|
||||||
wearableProps.parentID = doppelganger.id;
|
|
||||||
wearableProps.parentJointIndex = joint;
|
|
||||||
|
|
||||||
//create a new one
|
|
||||||
wearableProps.script = MIRRORED_ENTITY_SCRIPT_URL;
|
|
||||||
wearableProps.name = 'Hifi-Doppelganger-Mirrored-Entity';
|
|
||||||
wearableProps.userData = JSON.stringify({
|
|
||||||
doppelgangerKey: {
|
|
||||||
baseEntity: baseEntity,
|
|
||||||
doppelganger: doppelganger.id
|
|
||||||
}
|
|
||||||
})
|
|
||||||
var mirrorEntity = Entities.addEntity(wearableProps);
|
|
||||||
|
|
||||||
var mirrorEntityProps = Entities.getEntityProperties(mirrorEntity)
|
|
||||||
print('MIRROR PROPS::' + JSON.stringify(mirrorEntityProps))
|
|
||||||
var wearablePair = {
|
|
||||||
baseEntity: baseEntity,
|
|
||||||
mirrorEntity: mirrorEntity
|
|
||||||
}
|
|
||||||
|
|
||||||
wearablePairs.push(wearablePair);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action === 'update') {
|
|
||||||
wearableProps.parentID = doppelganger.id;
|
|
||||||
|
|
||||||
var mirrorEntity = getMirrorEntityForBaseEntity(baseEntity);
|
|
||||||
// print('MIRROR ENTITY, newPosition' + mirrorEntity + ":::" + JSON.stringify(newPosition))
|
|
||||||
Entities.editEntity(mirrorEntity, wearableProps)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action === 'remove') {
|
|
||||||
Entities.deleteEntity(getMirrorEntityForBaseEntity(baseEntity))
|
|
||||||
wearablePairs = wearablePairs.filter(function(obj) {
|
|
||||||
return obj.baseEntity !== baseEntity;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action === 'updateBase') {
|
|
||||||
//this gets called when the mirrored entity gets grabbed. now we move the
|
|
||||||
var mirrorEntityProperties = Entities.getEntityProperties(message.mirrorEntity)
|
|
||||||
var doppelgangerToMirrorEntity = Vec3.subtract(doppelgangerProps.position, mirrorEntityProperties.position);
|
|
||||||
var newPosition = Vec3.sum(MyAvatar.position, doppelgangerToMirrorEntity);
|
|
||||||
|
|
||||||
delete mirrorEntityProperties.id;
|
|
||||||
delete mirrorEntityProperties.created;
|
|
||||||
delete mirrorEntityProperties.age;
|
|
||||||
delete mirrorEntityProperties.ageAsText;
|
|
||||||
mirrorEntityProperties.position = newPosition;
|
|
||||||
mirrorEntityProperties.parentID = MyAvatar.sessionUUID;
|
|
||||||
Entities.editEntity(message.baseEntity, mirrorEntityProperties);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function cleanup() {
|
|
||||||
|
|
||||||
Script.update.disconnect(updateDoppelganger);
|
|
||||||
|
|
||||||
doppelgangers.forEach(function(doppelganger) {
|
|
||||||
print('DELETING DOPPELGANGER' + doppelganger.id)
|
|
||||||
Entities.deleteEntity(doppelganger.id);
|
|
||||||
});
|
|
||||||
|
|
||||||
doppelgangers = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
})
|
|
|
@ -114,7 +114,7 @@
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
rotation: gunProperties.rotation,
|
rotation: gunProperties.rotation,
|
||||||
position: this.getGunTipPosition(gunProperties),
|
position: this.getGunTipPosition(gunProperties),
|
||||||
gravity:PING_PONG_GUN_GRAVITY,
|
gravity: PING_PONG_GUN_GRAVITY,
|
||||||
velocity: forwardVec,
|
velocity: forwardVec,
|
||||||
lifetime: 10,
|
lifetime: 10,
|
||||||
userData: JSON.stringify({
|
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_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';
|
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({
|
var pingPongGun = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
modelURL: MODEL_URL,
|
modelURL: MODEL_URL,
|
||||||
|
@ -28,10 +28,10 @@ _PingPongGun = function(spawnPosition, spawnRotation) {
|
||||||
y: 0.3875,
|
y: 0.3875,
|
||||||
z: 0.9931
|
z: 0.9931
|
||||||
},
|
},
|
||||||
gravity:{
|
gravity: {
|
||||||
x:0,
|
x: 0,
|
||||||
y:-3,
|
y: -3,
|
||||||
z:0
|
z: 0
|
||||||
},
|
},
|
||||||
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
|
rotation: Quat.fromPitchYawRollDegrees(spawnRotation.x, spawnRotation.y, spawnRotation.z),
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
var utilsPath = Script.resolvePath('utils.js');
|
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 fishTankPath = Script.resolvePath('fishTank/wrapper.js?' + Math.random());
|
||||||
|
|
||||||
var tiltMazePath = Script.resolvePath("tiltMaze/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 cuckooClockPath = Script.resolvePath("cuckooClock/wrapper.js?" + Math.random());
|
||||||
|
|
||||||
|
|
||||||
var pingPongGunPath = Script.resolvePath("pingPongGun/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(kineticPath);
|
||||||
|
|
||||||
Script.include(utilsPath);
|
|
||||||
Script.include(fishTankPath);
|
Script.include(fishTankPath);
|
||||||
Script.include(tiltMazePath);
|
Script.include(tiltMazePath);
|
||||||
Script.include(whiteboardPath);
|
Script.include(whiteboardPath);
|
||||||
Script.include(plantPath);
|
Script.include(plantPath);
|
||||||
Script.include(cuckooClockPath);
|
Script.include(cuckooClockPath);
|
||||||
|
|
||||||
Script.include(pingPongGunPath);
|
Script.include(pingPongGunPath);
|
||||||
|
Script.include(transformerPath);
|
||||||
|
|
||||||
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
|
var TRANSFORMER_URL_ARTEMIS = '';
|
||||||
x: 0,
|
var TRANSFORMER_URL_ALBERT = '';
|
||||||
y: 0.5,
|
var TRANSFORMER_URL_BEING_OF_LIGHT = '';
|
||||||
z: 0
|
var TRANSFORMER_URL_KATE = '';
|
||||||
}), Vec3.multiply(1, Quat.getFront(Camera.getOrientation())));
|
var TRANSFORMER_URL_WILL = '';
|
||||||
|
|
||||||
Reset.prototype = {
|
Reset.prototype = {
|
||||||
tidying: false,
|
tidying: false,
|
||||||
|
@ -98,6 +100,7 @@
|
||||||
Script.setTimeout(function() {
|
Script.setTimeout(function() {
|
||||||
_this.createKineticEntities();
|
_this.createKineticEntities();
|
||||||
_this.createDynamicEntities();
|
_this.createDynamicEntities();
|
||||||
|
_this.createTransformers();
|
||||||
}, 750)
|
}, 750)
|
||||||
|
|
||||||
|
|
||||||
|
@ -156,7 +159,7 @@
|
||||||
z: 0
|
z: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
var pingPongGun = new _PingPongGun({
|
var pingPongGun = new HomePingPongGun({
|
||||||
x: 1101.2123,
|
x: 1101.2123,
|
||||||
y: 460.2328,
|
y: 460.2328,
|
||||||
z: -65.8513
|
z: -65.8513
|
||||||
|
@ -244,15 +247,15 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
var cellPoster = new PosterCell({
|
var cellPoster = new PosterCell({
|
||||||
x:1103.78,
|
x: 1103.78,
|
||||||
y:461,
|
y: 461,
|
||||||
z:-70.3
|
z: -70.3
|
||||||
});
|
});
|
||||||
|
|
||||||
var playaPoster = new PosterPlaya({
|
var playaPoster = new PosterPlaya({
|
||||||
x:1101.8,
|
x: 1101.8,
|
||||||
y:461,
|
y: 461,
|
||||||
z:-73.3
|
z: -73.3
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -264,6 +267,39 @@
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
createTransformers: function() {
|
||||||
|
var firstDollPosition: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
var dollRotation = {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
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() {
|
findAndDeleteHomeEntities: function() {
|
||||||
print('JBP trying to find home entities to delete')
|
print('JBP trying to find home entities to delete')
|
||||||
var resetProperties = Entities.getEntityProperties(_this.entityID);
|
var resetProperties = Entities.getEntityProperties(_this.entityID);
|
||||||
|
|
|
@ -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