diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index b98620cbcb..2a523e9b9e 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -2761,24 +2761,15 @@ bool MyAvatar::isDriveKeyDisabled(DriveKeys key) const { } void MyAvatar::triggerVerticalRecenter() { - //do something here - _follow._forceActivateVertical = true; - - + _follow.setForceActivateVertical(true); } void MyAvatar::triggerHorizontalRecenter() { - //do something here - _follow._forceActivateHorizontal = true; - - + _follow.setForceActivateHorizontal(true); } void MyAvatar::triggerRotationRecenter() { - //do something here - _follow._forceActivateRotation = true; - - + _follow.setForceActivateRotation(true); } // old school meat hook style @@ -3028,22 +3019,19 @@ void MyAvatar::FollowHelper::prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat if (!isActive(Vertical) && (shouldActivateVertical(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) { activate(Vertical); } - } - else { - if (!isActive(Rotation) && _forceActivateRotation) { + } else { + //qCDebug(interfaceapp) << "turned off the recenter" << endl; + if (!isActive(Rotation) && getForceActivateRotation()) { activate(Rotation); - _forceActivateRotation = false; - qCDebug(interfaceapp) << "the rotation property is activated+++++++++++++++++++++++" << endl; + setForceActivateRotation(false); } - if (!isActive(Horizontal) && _forceActivateHorizontal) { + if (!isActive(Horizontal) && getForceActivateHorizontal()) { activate(Horizontal); - _forceActivateHorizontal = false; - qCDebug(interfaceapp) << "the horizontal property is activated+++++++++++++++++++++++" << endl; + setForceActivateHorizontal(false); } - if (!isActive(Vertical) && _forceActivateVertical) { + if (!isActive(Vertical) && getForceActivateVertical()) { activate(Vertical); - _forceActivateVertical = false; - qCDebug(interfaceapp) << "the vertical property is activated+++++++++++++++++++++++" << endl; + setForceActivateVertical(false); } } @@ -3094,6 +3082,30 @@ glm::mat4 MyAvatar::FollowHelper::postPhysicsUpdate(const MyAvatar& myAvatar, co } } +bool MyAvatar::FollowHelper::getForceActivateRotation() { + return _forceActivateRotation; +} + +void MyAvatar::FollowHelper::setForceActivateRotation(bool val) { + _forceActivateRotation = val; +} + +bool MyAvatar::FollowHelper::getForceActivateVertical() { + return _forceActivateVertical; +} + +void MyAvatar::FollowHelper::setForceActivateVertical(bool val) { + _forceActivateVertical = val; +} + +bool MyAvatar::FollowHelper::getForceActivateHorizontal() { + return _forceActivateHorizontal; +} + +void MyAvatar::FollowHelper::setForceActivateHorizontal(bool val) { + _forceActivateHorizontal = val; +} + float MyAvatar::getAccelerationEnergy() { glm::vec3 velocity = getWorldVelocity(); int changeInVelocity = abs(velocity.length() - priorVelocity.length()); diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index c3136b14c2..6f7caa5c7d 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -104,9 +104,6 @@ class MyAvatar : public Avatar { * @property rightHandTipPose {Pose} READ-ONLY. Returns a pose offset 30 cm from MyAvatar.rightHandPose * @property hmdLeanRecenterEnabled {bool} This can be used disable the hmd lean recenter behavior. This behavior is what causes your avatar * to follow your HMD as you walk around the room, in room scale VR. Disabling this is useful if you desire to pin the avatar to a fixed location. - * @property hmdVerticalRecenterEnabled {bool} This can be used to turn vertical recenter off and on. - * @property hmdHorizontalRecenterEnabled {bool} This can be used to turn horizontal recenter off and on. - * @property hmdRotationRecenterEnabled {bool} This can be used to turn rotational recenter off and on. * @property collisionsEnabled {bool} This can be used to disable collisions between the avatar and the world. * @property useAdvancedMovementControls {bool} Stores the user preference only, does not change user mappings, this is done in the defaultScript * "scripts/system/controllers/toggleAdvancedMovementForHandControllers.js". @@ -152,9 +149,6 @@ class MyAvatar : public Avatar { Q_PROPERTY(bool isAway READ getIsAway WRITE setAway) Q_PROPERTY(bool hmdLeanRecenterEnabled READ getHMDLeanRecenterEnabled WRITE setHMDLeanRecenterEnabled) - Q_PROPERTY(bool hmdVerticalRecenterEnabled READ getHMDVerticalRecenterEnabled WRITE setHMDVerticalRecenterEnabled) - Q_PROPERTY(bool hmdHorizontalRecenterEnabled READ getHMDHorizontalRecenterEnabled WRITE setHMDHorizontalRecenterEnabled) - Q_PROPERTY(bool hmdRotationRecenterEnabled READ getHMDRotationRecenterEnabled WRITE setHMDRotationRecenterEnabled) Q_PROPERTY(bool collisionsEnabled READ getCollisionsEnabled WRITE setCollisionsEnabled) Q_PROPERTY(bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled) Q_PROPERTY(bool useAdvancedMovementControls READ useAdvancedMovementControls WRITE setUseAdvancedMovementControls) @@ -380,15 +374,6 @@ public: Q_INVOKABLE void setHMDLeanRecenterEnabled(bool value) { _hmdLeanRecenterEnabled = value; } Q_INVOKABLE bool getHMDLeanRecenterEnabled() const { return _hmdLeanRecenterEnabled; } - Q_INVOKABLE void setHMDVerticalRecenterEnabled(bool value) { _hmdVerticalRecenterEnabled = value; } - Q_INVOKABLE bool getHMDVerticalRecenterEnabled() const { return _hmdVerticalRecenterEnabled; } - - Q_INVOKABLE void setHMDHorizontalRecenterEnabled(bool value) { _hmdHorizontalRecenterEnabled = value; } - Q_INVOKABLE bool getHMDHorizontalRecenterEnabled() const { return _hmdHorizontalRecenterEnabled; } - - Q_INVOKABLE void setHMDRotationRecenterEnabled(bool value) { _hmdRotationRecenterEnabled = value; } - Q_INVOKABLE bool getHMDRotationRecenterEnabled() const { return _hmdRotationRecenterEnabled; } - bool useAdvancedMovementControls() const { return _useAdvancedMovementControls.get(); } void setUseAdvancedMovementControls(bool useAdvancedMovementControls) { _useAdvancedMovementControls.set(useAdvancedMovementControls); } @@ -822,8 +807,11 @@ private: void prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat4& bodySensorMatrix, const glm::mat4& currentBodyMatrix, bool hasDriveInput); glm::mat4 postPhysicsUpdate(const MyAvatar& myAvatar, const glm::mat4& currentBodyMatrix); bool getForceActivateRotation(); + void setForceActivateRotation(bool val); bool getForceActivateVertical(); + void setForceActivateVertical(bool val); bool getForceActivateHorizontal(); + void setForceActivateHorizontal(bool val); bool _forceActivateRotation{ false }; bool _forceActivateVertical{ false }; bool _forceActivateHorizontal{ false }; @@ -862,9 +850,7 @@ private: mutable std::mutex _controllerPoseMapMutex; bool _hmdLeanRecenterEnabled = true; - bool _hmdVerticalRecenterEnabled = true; - bool _hmdHorizontalRecenterEnabled = true; - bool _hmdRotationRecenterEnabled = true; + AnimPose _prePhysicsRoomPose; std::mutex _holdActionsMutex; std::vector _holdActions;