mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:38:02 +02:00
Steam invite are facing the current position
This commit is contained in:
parent
aa2ae31aab
commit
51b45f8f73
4 changed files with 49 additions and 10 deletions
|
@ -111,7 +111,7 @@ void DiscoverabilityManager::updateLocation() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Steam
|
// Update Steam
|
||||||
SteamClient::updateLocation(domainHandler.getHostname(), addressManager->currentAddress());
|
SteamClient::updateLocation(domainHandler.getHostname(), addressManager->currentFacingAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) {
|
void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply) {
|
||||||
|
|
|
@ -122,11 +122,13 @@ MyAvatar::MyAvatar(RigPointer rig) :
|
||||||
_driveKeys[i] = 0.0f;
|
_driveKeys[i] = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Necessary to select the correct slot
|
||||||
|
using SlotType = void(MyAvatar::*)(const glm::vec3&, bool, const glm::quat&, bool);
|
||||||
|
|
||||||
// connect to AddressManager signal for location jumps
|
// connect to AddressManager signal for location jumps
|
||||||
connect(DependencyManager::get<AddressManager>().data(), &AddressManager::locationChangeRequired,
|
connect(DependencyManager::get<AddressManager>().data(), &AddressManager::locationChangeRequired,
|
||||||
[=](const glm::vec3& newPosition, bool hasOrientation, const glm::quat& newOrientation, bool shouldFaceLocation){
|
this, static_cast<SlotType>(&MyAvatar::goToLocation));
|
||||||
goToLocation(newPosition, hasOrientation, newOrientation, shouldFaceLocation);
|
|
||||||
});
|
|
||||||
|
|
||||||
_characterController.setEnabled(true);
|
_characterController.setEnabled(true);
|
||||||
|
|
||||||
|
@ -1859,7 +1861,7 @@ void MyAvatar::goToLocation(const glm::vec3& newPosition,
|
||||||
glm::quat quatOrientation = cancelOutRollAndPitch(newOrientation);
|
glm::quat quatOrientation = cancelOutRollAndPitch(newOrientation);
|
||||||
|
|
||||||
if (shouldFaceLocation) {
|
if (shouldFaceLocation) {
|
||||||
quatOrientation = newOrientation * glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
quatOrientation = newOrientation * glm::angleAxis(PI, Vectors::UP);
|
||||||
|
|
||||||
// move the user a couple units away
|
// move the user a couple units away
|
||||||
const float DISTANCE_TO_USER = 2.0f;
|
const float DISTANCE_TO_USER = 2.0f;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
|
#include <NumericalConstants.h>
|
||||||
#include <SettingHandle.h>
|
#include <SettingHandle.h>
|
||||||
#include <UUID.h>
|
#include <UUID.h>
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ bool AddressManager::isConnected() {
|
||||||
return DependencyManager::get<NodeList>()->getDomainHandler().isConnected();
|
return DependencyManager::get<NodeList>()->getDomainHandler().isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QUrl AddressManager::currentAddress() const {
|
QUrl AddressManager::currentAddress() const {
|
||||||
QUrl hifiURL;
|
QUrl hifiURL;
|
||||||
|
|
||||||
hifiURL.setScheme(HIFI_URL_SCHEME);
|
hifiURL.setScheme(HIFI_URL_SCHEME);
|
||||||
|
@ -61,6 +62,21 @@ const QUrl AddressManager::currentAddress() const {
|
||||||
return hifiURL;
|
return hifiURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QUrl AddressManager::currentFacingAddress() const {
|
||||||
|
QUrl hifiURL;
|
||||||
|
|
||||||
|
hifiURL.setScheme(HIFI_URL_SCHEME);
|
||||||
|
hifiURL.setHost(_host);
|
||||||
|
|
||||||
|
if (_port != 0 && _port != DEFAULT_DOMAIN_SERVER_PORT) {
|
||||||
|
hifiURL.setPort(_port);
|
||||||
|
}
|
||||||
|
|
||||||
|
hifiURL.setPath(currentFacingPath());
|
||||||
|
|
||||||
|
return hifiURL;
|
||||||
|
}
|
||||||
|
|
||||||
void AddressManager::loadSettings(const QString& lookupString) {
|
void AddressManager::loadSettings(const QString& lookupString) {
|
||||||
if (lookupString.isEmpty()) {
|
if (lookupString.isEmpty()) {
|
||||||
handleUrl(currentAddressHandle.get().toString(), LookupTrigger::StartupFromSettings);
|
handleUrl(currentAddressHandle.get().toString(), LookupTrigger::StartupFromSettings);
|
||||||
|
@ -97,7 +113,7 @@ void AddressManager::storeCurrentAddress() {
|
||||||
currentAddressHandle.set(currentAddress());
|
currentAddressHandle.set(currentAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString AddressManager::currentPath(bool withOrientation) const {
|
QString AddressManager::currentPath(bool withOrientation) const {
|
||||||
|
|
||||||
if (_positionGetter) {
|
if (_positionGetter) {
|
||||||
QString pathString = "/" + createByteArray(_positionGetter());
|
QString pathString = "/" + createByteArray(_positionGetter());
|
||||||
|
@ -121,6 +137,25 @@ const QString AddressManager::currentPath(bool withOrientation) const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AddressManager::currentFacingPath() const {
|
||||||
|
if (_positionGetter && _orientationGetter) {
|
||||||
|
auto position = _positionGetter();
|
||||||
|
auto orientation = _orientationGetter();
|
||||||
|
|
||||||
|
// move the user a couple units away
|
||||||
|
const float DISTANCE_TO_USER = 2.0f;
|
||||||
|
position += orientation * Vectors::FRONT * DISTANCE_TO_USER;
|
||||||
|
|
||||||
|
// rotate the user by 180 degrees
|
||||||
|
orientation = orientation * glm::angleAxis(PI, Vectors::UP);
|
||||||
|
|
||||||
|
return "/" + createByteArray(position) + "/" + createByteArray(orientation);
|
||||||
|
} else {
|
||||||
|
qCDebug(networking) << "Cannot create address path without a getter for position/orientation.";
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const JSONCallbackParameters& AddressManager::apiCallbackParameters() {
|
const JSONCallbackParameters& AddressManager::apiCallbackParameters() {
|
||||||
static bool hasSetupParameters = false;
|
static bool hasSetupParameters = false;
|
||||||
static JSONCallbackParameters callbackParams;
|
static JSONCallbackParameters callbackParams;
|
||||||
|
|
|
@ -57,8 +57,10 @@ public:
|
||||||
bool isConnected();
|
bool isConnected();
|
||||||
const QString& getProtocol() { return HIFI_URL_SCHEME; };
|
const QString& getProtocol() { return HIFI_URL_SCHEME; };
|
||||||
|
|
||||||
const QUrl currentAddress() const;
|
QUrl currentAddress() const;
|
||||||
const QString currentPath(bool withOrientation = true) const;
|
QUrl currentFacingAddress() const;
|
||||||
|
QString currentPath(bool withOrientation = true) const;
|
||||||
|
QString currentFacingPath() const;
|
||||||
|
|
||||||
const QUuid& getRootPlaceID() const { return _rootPlaceID; }
|
const QUuid& getRootPlaceID() const { return _rootPlaceID; }
|
||||||
const QString& getPlaceName() const { return _placeName; }
|
const QString& getPlaceName() const { return _placeName; }
|
||||||
|
|
Loading…
Reference in a new issue