mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 21:18:06 +02:00
Fix MyAvatar::centerBody breaking existing scripts (eg. away.js) by having a new parameter:
Moved the body of the function to a private internal method (centerBodyInternal), which takes the parameter instead.
Previously, when leaving 'away' state, the 'Away' overlay would stay on screen because of the bug.
The bug started in "VR fixes for: couldn't sit on the floor, wrong walk directions." (2179c153de
).
This commit is contained in:
parent
6fc40385ca
commit
287f710ea1
2 changed files with 12 additions and 7 deletions
|
@ -497,14 +497,18 @@ void MyAvatar::resetSensorsAndBody() {
|
|||
reset(true, false, true);
|
||||
}
|
||||
|
||||
// forceFollowYPos: true to force the body matrix to be affected by the HMD's
|
||||
// vertical position, even if crouch recentering is disabled.
|
||||
void MyAvatar::centerBody(const bool forceFollowYPos) {
|
||||
void MyAvatar::centerBody() {
|
||||
if (QThread::currentThread() != thread()) {
|
||||
QMetaObject::invokeMethod(this, "centerBody");
|
||||
return;
|
||||
}
|
||||
|
||||
centerBodyInternal(false);
|
||||
}
|
||||
|
||||
// forceFollowYPos (default false): true to force the body matrix to be affected by the HMD's
|
||||
// vertical position, even if crouch recentering is disabled.
|
||||
void MyAvatar::centerBodyInternal(const bool forceFollowYPos) {
|
||||
// derive the desired body orientation from the current hmd orientation, before the sensor reset.
|
||||
auto newBodySensorMatrix =
|
||||
deriveBodyFromHMDSensor(forceFollowYPos); // Based on current cached HMD position/rotation..
|
||||
|
@ -5323,7 +5327,7 @@ void MyAvatar::setAllowAvatarStandingPreference(const MyAvatar::AllowAvatarStand
|
|||
|
||||
// Set the correct vertical position for the avatar body relative to the HMD,
|
||||
// according to the newly-selected avatar standing preference.
|
||||
centerBody(false);
|
||||
centerBodyInternal(false);
|
||||
}
|
||||
|
||||
// Set the user preference of when the avatar may lean.
|
||||
|
@ -6693,7 +6697,7 @@ void MyAvatar::beginSit(const glm::vec3& position, const glm::quat& rotation) {
|
|||
setHMDLeanRecenterEnabled(false);
|
||||
// Disable movement
|
||||
setSitDriveKeysStatus(false);
|
||||
centerBody(true);
|
||||
centerBodyInternal(true);
|
||||
int hipIndex = getJointIndex("Hips");
|
||||
clearPinOnJoint(hipIndex);
|
||||
pinJoint(hipIndex, position, rotation);
|
||||
|
@ -6711,7 +6715,7 @@ void MyAvatar::endSit(const glm::vec3& position, const glm::quat& rotation) {
|
|||
_characterController.setSeated(false);
|
||||
setCollisionsEnabled(true);
|
||||
setHMDLeanRecenterEnabled(true);
|
||||
centerBody(false);
|
||||
centerBodyInternal(false);
|
||||
slamPosition(position);
|
||||
setWorldOrientation(rotation);
|
||||
|
||||
|
|
|
@ -594,7 +594,7 @@ public:
|
|||
* the HMD.
|
||||
* @function MyAvatar.centerBody
|
||||
*/
|
||||
Q_INVOKABLE void centerBody(const bool forceFollowYPos); // thread-safe
|
||||
Q_INVOKABLE void centerBody(); // thread-safe
|
||||
|
||||
|
||||
/**jsdoc
|
||||
|
@ -2812,6 +2812,7 @@ private:
|
|||
void resetLookAtRotation(const glm::vec3& avatarPosition, const glm::quat& avatarOrientation);
|
||||
void resetPointAt();
|
||||
static glm::vec3 aimToBlendValues(const glm::vec3& aimVector, const glm::quat& frameOrientation);
|
||||
void centerBodyInternal(const bool forceFollowYPos = false);
|
||||
|
||||
// Avatar Preferences
|
||||
QUrl _fullAvatarURLFromPreferences;
|
||||
|
|
Loading…
Reference in a new issue