mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 16:41:02 +02:00
rotation
This commit is contained in:
parent
fa5d9f8442
commit
cfa39bec7f
1 changed files with 12 additions and 27 deletions
|
@ -75,8 +75,8 @@
|
||||||
type: 'Model',
|
type: 'Model',
|
||||||
modelURL: avatarModelURL,
|
modelURL: avatarModelURL,
|
||||||
// dimensions: getAvatarDimensions(avatar),
|
// dimensions: getAvatarDimensions(avatar),
|
||||||
position: putDoppelgangerAcrossFromAvatar(this, avatar),
|
position: matchBaseRotation(),
|
||||||
rotation: rotateDoppelgangerTowardAvatar(this, avatar),
|
rotation: matchBaseRotation(),
|
||||||
collisionsWillMove: false,
|
collisionsWillMove: false,
|
||||||
ignoreForCollisions: false,
|
ignoreForCollisions: false,
|
||||||
script: FREEZE_TOGGLER_SCRIPT_URL,
|
script: FREEZE_TOGGLER_SCRIPT_URL,
|
||||||
|
@ -398,12 +398,8 @@
|
||||||
return Entities.addEntity(doppelganger.initialProperties);
|
return Entities.addEntity(doppelganger.initialProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
function putDoppelgangerAcrossFromAvatar(doppelganger, avatar) {
|
function matchBasePosition(){
|
||||||
var avatarRot = Quat.fromPitchYawRollDegrees(0, avatar.bodyYaw, 0.0);
|
|
||||||
var position;
|
|
||||||
|
|
||||||
var ids = Entities.findEntities(MyAvatar.position, 20);
|
var ids = Entities.findEntities(MyAvatar.position, 20);
|
||||||
var hasBase = false;
|
|
||||||
for (var i = 0; i < ids.length; i++) {
|
for (var i = 0; i < ids.length; i++) {
|
||||||
var entityID = ids[i];
|
var entityID = ids[i];
|
||||||
var props = Entities.getEntityProperties(entityID, "name");
|
var props = Entities.getEntityProperties(entityID, "name");
|
||||||
|
@ -412,19 +408,12 @@
|
||||||
var details = Entities.getEntityProperties(entityID, ["position", "dimensions"]);
|
var details = Entities.getEntityProperties(entityID, ["position", "dimensions"]);
|
||||||
details.position.y += getAvatarFootOffset();
|
details.position.y += getAvatarFootOffset();
|
||||||
details.position.y += details.dimensions.y / 2;
|
details.position.y += details.dimensions.y / 2;
|
||||||
position = details.position;
|
return details.position;
|
||||||
hasBase = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBase === false) {
|
|
||||||
position = Vec3.sum(avatar.position, Vec3.multiply(1.5, Quat.getFront(avatarRot)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return position;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getAvatarFootOffset() {
|
function getAvatarFootOffset() {
|
||||||
var data = getJointData();
|
var data = getJointData();
|
||||||
var upperLeg, lowerLeg, foot, toe, toeTop;
|
var upperLeg, lowerLeg, foot, toe, toeTop;
|
||||||
|
@ -459,9 +448,7 @@
|
||||||
return dimensions;
|
return dimensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rotateDoppelgangerTowardAvatar(doppelganger, avatar) {
|
function matchBaseRotation(){
|
||||||
var avatarRot = Quat.fromPitchYawRollDegrees(0, avatar.bodyYaw, 0.0);
|
|
||||||
|
|
||||||
var ids = Entities.findEntities(MyAvatar.position, 20);
|
var ids = Entities.findEntities(MyAvatar.position, 20);
|
||||||
var hasBase = false;
|
var hasBase = false;
|
||||||
for (var i = 0; i < ids.length; i++) {
|
for (var i = 0; i < ids.length; i++) {
|
||||||
|
@ -470,15 +457,13 @@
|
||||||
var name = props.name;
|
var name = props.name;
|
||||||
if (name === "Hifi-Dressing-Room-Base") {
|
if (name === "Hifi-Dressing-Room-Base") {
|
||||||
var details = Entities.getEntityProperties(entityID, "rotation");
|
var details = Entities.getEntityProperties(entityID, "rotation");
|
||||||
avatarRot = details.rotation;
|
print('DOPPELGANGER ROTATION SET TO BASE:: ' + JSON.stringify(details.rotation))
|
||||||
|
return details.rotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasBase === false) {
|
|
||||||
avatarRot = Vec3.multiply(-1, avatarRot);
|
|
||||||
}
|
|
||||||
return avatarRot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var isConnected = false;
|
var isConnected = false;
|
||||||
|
|
||||||
function connectDoppelgangerUpdates() {
|
function connectDoppelgangerUpdates() {
|
||||||
|
@ -488,10 +473,10 @@
|
||||||
|
|
||||||
function disconnectDoppelgangerUpdates() {
|
function disconnectDoppelgangerUpdates() {
|
||||||
|
|
||||||
if (isConnected === true) {
|
// if (isConnected === true) {
|
||||||
print('SHOULD DISCONNECT')
|
print('SHOULD DISCONNECT')
|
||||||
Script.update.disconnect(updateDoppelganger);
|
Script.update.disconnect(updateDoppelganger);
|
||||||
}
|
// }
|
||||||
isConnected = false;
|
isConnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue