mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 18:56:55 +02:00
Fixed avatar rotation upon teleportation using Pal
Added "VisitUserFromPAL" to LookupTrigger enum and bool "shouldMatchOrientation" to goToUser()
This commit is contained in:
parent
bec7f7c644
commit
6f81dd53f2
4 changed files with 19 additions and 10 deletions
|
@ -433,7 +433,7 @@ Item {
|
||||||
anchors.verticalCenter: nameCardRemoveConnectionImage.verticalCenter
|
anchors.verticalCenter: nameCardRemoveConnectionImage.verticalCenter
|
||||||
x: 240
|
x: 240
|
||||||
onClicked: {
|
onClicked: {
|
||||||
AddressManager.goToUser(thisNameCard.userName);
|
AddressManager.goToUser(thisNameCard.userName, false);
|
||||||
UserActivityLogger.palAction("go_to_user", thisNameCard.userName);
|
UserActivityLogger.palAction("go_to_user", thisNameCard.userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,9 @@ Item {
|
||||||
// the avatar goes into fly mode rather than falling. However, that is not exposed to Javascript right now.
|
// 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.
|
// 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.
|
// Note, however, that this script allows teleporting to a person in the air, while teleport.js is going to a grounded target.
|
||||||
|
// Position avatar 2 metres from the target in the direction that target avatar was facing.
|
||||||
MyAvatar.position = Vec3.sum(avatar.position, Vec3.multiplyQbyV(avatar.orientation, {x: 0, y: 0, z: -2}));
|
MyAvatar.position = Vec3.sum(avatar.position, Vec3.multiplyQbyV(avatar.orientation, {x: 0, y: 0, z: -2}));
|
||||||
|
// Rotate avatar on Y axis to face target avatar.
|
||||||
MyAvatar.orientation = Quat.multiply(avatar.orientation, {y: 1});
|
MyAvatar.orientation = Quat.multiply(avatar.orientation, {y: 1});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -830,7 +830,7 @@ Rectangle {
|
||||||
hoverEnabled: enabled
|
hoverEnabled: enabled
|
||||||
enabled: connectionsNameCard.selected && pal.activeTab == "connectionsTab"
|
enabled: connectionsNameCard.selected && pal.activeTab == "connectionsTab"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
AddressManager.goToUser(model.userName);
|
AddressManager.goToUser(model.userName, false);
|
||||||
UserActivityLogger.palAction("go_to_user", model.userName);
|
UserActivityLogger.palAction("go_to_user", model.userName);
|
||||||
}
|
}
|
||||||
onEntered: connectionsLocationData.color = hifi.colors.blueHighlight;
|
onEntered: connectionsLocationData.color = hifi.colors.blueHighlight;
|
||||||
|
|
|
@ -665,6 +665,11 @@ bool AddressManager::handleViewpoint(const QString& viewpointString, bool should
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (trigger == LookupTrigger::VisitUserFromPAL) {
|
||||||
|
qCDebug(networking) << "trigger is VisitUserFromPAL -- applying Quat.cancelOutRollAndPitch";
|
||||||
|
newOrientation = cancelOutRollAndPitch(newOrientation);
|
||||||
|
}
|
||||||
|
|
||||||
emit locationChangeRequired(newPosition, orientationChanged, newOrientation, shouldFace);
|
emit locationChangeRequired(newPosition, orientationChanged, newOrientation, shouldFace);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -729,13 +734,14 @@ bool AddressManager::setDomainInfo(const QString& hostname, quint16 port, Lookup
|
||||||
return hostChanged;
|
return hostChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressManager::goToUser(const QString& username) {
|
void AddressManager::goToUser(const QString& username, bool shouldMatchOrientation) {
|
||||||
QString formattedUsername = QUrl::toPercentEncoding(username);
|
QString formattedUsername = QUrl::toPercentEncoding(username);
|
||||||
|
|
||||||
// for history storage handling we remember how this lookup was trigged - for a username it's always user input
|
// for history storage handling we remember how this lookup was triggered - for a username it's always user input
|
||||||
QVariantMap requestParams;
|
QVariantMap requestParams;
|
||||||
requestParams.insert(LOOKUP_TRIGGER_KEY, static_cast<int>(LookupTrigger::UserInput));
|
requestParams.insert(LOOKUP_TRIGGER_KEY, static_cast<int>(
|
||||||
|
shouldMatchOrientation ? LookupTrigger::UserInput : LookupTrigger::VisitUserFromPAL
|
||||||
|
));
|
||||||
// this is a username - pull the captured name and lookup that user's location
|
// this is a username - pull the captured name and lookup that user's location
|
||||||
DependencyManager::get<AccountManager>()->sendRequest(GET_USER_LOCATION.arg(formattedUsername),
|
DependencyManager::get<AccountManager>()->sendRequest(GET_USER_LOCATION.arg(formattedUsername),
|
||||||
AccountManagerAuth::Optional,
|
AccountManagerAuth::Optional,
|
||||||
|
@ -841,8 +847,8 @@ void AddressManager::addCurrentAddressToHistory(LookupTrigger trigger) {
|
||||||
// and do not but it into the back stack
|
// and do not but it into the back stack
|
||||||
_forwardStack.push(currentAddress());
|
_forwardStack.push(currentAddress());
|
||||||
} else {
|
} else {
|
||||||
if (trigger == LookupTrigger::UserInput) {
|
if (trigger == LookupTrigger::UserInput || trigger == LookupTrigger::VisitUserFromPAL) {
|
||||||
// anyime the user has manually looked up an address we know we should clear the forward stack
|
// anyime the user has actively triggered an address we know we should clear the forward stack
|
||||||
_forwardStack.clear();
|
_forwardStack.clear();
|
||||||
|
|
||||||
emit goForwardPossible(false);
|
emit goForwardPossible(false);
|
||||||
|
|
|
@ -55,7 +55,8 @@ public:
|
||||||
DomainPathResponse,
|
DomainPathResponse,
|
||||||
Internal,
|
Internal,
|
||||||
AttemptedRefresh,
|
AttemptedRefresh,
|
||||||
Suggestions
|
Suggestions,
|
||||||
|
VisitUserFromPAL
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isConnected();
|
bool isConnected();
|
||||||
|
@ -95,7 +96,7 @@ public slots:
|
||||||
void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); }
|
void goToLocalSandbox(QString path = "", LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(SANDBOX_HIFI_ADDRESS + path, trigger); }
|
||||||
void goToEntry(LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(DEFAULT_HIFI_ADDRESS, trigger); }
|
void goToEntry(LookupTrigger trigger = LookupTrigger::StartupFromSettings) { handleUrl(DEFAULT_HIFI_ADDRESS, trigger); }
|
||||||
|
|
||||||
void goToUser(const QString& username);
|
void goToUser(const QString& username, bool shouldMatchOrientation = true);
|
||||||
|
|
||||||
void refreshPreviousLookup();
|
void refreshPreviousLookup();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue