mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +02:00
Fix teleporting to another user from the PAL
This commit is contained in:
parent
a0cd210b60
commit
6b659101d5
1 changed files with 2 additions and 20 deletions
|
@ -243,7 +243,7 @@ Item {
|
||||||
enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== "" && isPresent;
|
enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== "" && isPresent;
|
||||||
hoverEnabled: enabled
|
hoverEnabled: enabled
|
||||||
onClicked: {
|
onClicked: {
|
||||||
goToUserInDomain(thisNameCard.uuid);
|
AddressManager.goToUser(thisNameCard.userName);
|
||||||
UserActivityLogger.palAction("go_to_user_in_domain", thisNameCard.uuid);
|
UserActivityLogger.palAction("go_to_user_in_domain", thisNameCard.uuid);
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
|
@ -338,7 +338,7 @@ Item {
|
||||||
enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== "" && isPresent;
|
enabled: selected && pal.activeTab == "nearbyTab" && thisNameCard.userName !== "" && isPresent;
|
||||||
hoverEnabled: enabled
|
hoverEnabled: enabled
|
||||||
onClicked: {
|
onClicked: {
|
||||||
goToUserInDomain(thisNameCard.uuid);
|
AddressManager.goToUser(thisNameCard.userName);
|
||||||
UserActivityLogger.palAction("go_to_user_in_domain", thisNameCard.uuid);
|
UserActivityLogger.palAction("go_to_user_in_domain", thisNameCard.uuid);
|
||||||
}
|
}
|
||||||
onEntered: {
|
onEntered: {
|
||||||
|
@ -582,22 +582,4 @@ Item {
|
||||||
UserActivityLogger.palAction("avatar_gain_changed", avatarUuid);
|
UserActivityLogger.palAction("avatar_gain_changed", avatarUuid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function body by Howard Stearns 2017-01-08
|
|
||||||
function goToUserInDomain(avatarUuid) {
|
|
||||||
var avatar = AvatarList.getAvatar(avatarUuid);
|
|
||||||
if (!avatar) {
|
|
||||||
console.log("This avatar is no longer present. goToUserInDomain() failed.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var vector = Vec3.subtract(avatar.position, MyAvatar.position);
|
|
||||||
var distance = Vec3.length(vector);
|
|
||||||
var target = Vec3.multiply(Vec3.normalize(vector), distance - 2.0);
|
|
||||||
// FIXME: We would like the avatar to recompute the avatar's "maybe fly" test at the new position, so that if high enough up,
|
|
||||||
// the avatar goes into fly mode rather than falling. However, that is not exposed to Javascript right now.
|
|
||||||
// FIXME: it would be nice if this used the same teleport steps and smoothing as in the teleport.js script.
|
|
||||||
// Note, however, that this script allows teleporting to a person in the air, while teleport.js is going to a grounded target.
|
|
||||||
MyAvatar.orientation = Quat.lookAtSimple(MyAvatar.position, avatar.position);
|
|
||||||
MyAvatar.position = Vec3.sum(MyAvatar.position, target);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue