added get and set functions for the activate recenter variables

This commit is contained in:
amantley 2018-03-28 10:33:00 -07:00
parent 9f3b82a417
commit 95f1d0e4fa
2 changed files with 39 additions and 41 deletions

View file

@ -2761,24 +2761,15 @@ bool MyAvatar::isDriveKeyDisabled(DriveKeys key) const {
} }
void MyAvatar::triggerVerticalRecenter() { void MyAvatar::triggerVerticalRecenter() {
//do something here _follow.setForceActivateVertical(true);
_follow._forceActivateVertical = true;
} }
void MyAvatar::triggerHorizontalRecenter() { void MyAvatar::triggerHorizontalRecenter() {
//do something here _follow.setForceActivateHorizontal(true);
_follow._forceActivateHorizontal = true;
} }
void MyAvatar::triggerRotationRecenter() { void MyAvatar::triggerRotationRecenter() {
//do something here _follow.setForceActivateRotation(true);
_follow._forceActivateRotation = true;
} }
// old school meat hook style // 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)) { if (!isActive(Vertical) && (shouldActivateVertical(myAvatar, desiredBodyMatrix, currentBodyMatrix) || hasDriveInput)) {
activate(Vertical); activate(Vertical);
} }
} } else {
else { //qCDebug(interfaceapp) << "turned off the recenter" << endl;
if (!isActive(Rotation) && _forceActivateRotation) { if (!isActive(Rotation) && getForceActivateRotation()) {
activate(Rotation); activate(Rotation);
_forceActivateRotation = false; setForceActivateRotation(false);
qCDebug(interfaceapp) << "the rotation property is activated+++++++++++++++++++++++" << endl;
} }
if (!isActive(Horizontal) && _forceActivateHorizontal) { if (!isActive(Horizontal) && getForceActivateHorizontal()) {
activate(Horizontal); activate(Horizontal);
_forceActivateHorizontal = false; setForceActivateHorizontal(false);
qCDebug(interfaceapp) << "the horizontal property is activated+++++++++++++++++++++++" << endl;
} }
if (!isActive(Vertical) && _forceActivateVertical) { if (!isActive(Vertical) && getForceActivateVertical()) {
activate(Vertical); activate(Vertical);
_forceActivateVertical = false; setForceActivateVertical(false);
qCDebug(interfaceapp) << "the vertical property is activated+++++++++++++++++++++++" << endl;
} }
} }
@ -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() { float MyAvatar::getAccelerationEnergy() {
glm::vec3 velocity = getWorldVelocity(); glm::vec3 velocity = getWorldVelocity();
int changeInVelocity = abs(velocity.length() - priorVelocity.length()); int changeInVelocity = abs(velocity.length() - priorVelocity.length());

View file

@ -104,9 +104,6 @@ class MyAvatar : public Avatar {
* @property rightHandTipPose {Pose} READ-ONLY. Returns a pose offset 30 cm from MyAvatar.rightHandPose * @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 * @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. * 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 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 * @property useAdvancedMovementControls {bool} Stores the user preference only, does not change user mappings, this is done in the defaultScript
* "scripts/system/controllers/toggleAdvancedMovementForHandControllers.js". * "scripts/system/controllers/toggleAdvancedMovementForHandControllers.js".
@ -152,9 +149,6 @@ class MyAvatar : public Avatar {
Q_PROPERTY(bool isAway READ getIsAway WRITE setAway) Q_PROPERTY(bool isAway READ getIsAway WRITE setAway)
Q_PROPERTY(bool hmdLeanRecenterEnabled READ getHMDLeanRecenterEnabled WRITE setHMDLeanRecenterEnabled) 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 collisionsEnabled READ getCollisionsEnabled WRITE setCollisionsEnabled)
Q_PROPERTY(bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled) Q_PROPERTY(bool characterControllerEnabled READ getCharacterControllerEnabled WRITE setCharacterControllerEnabled)
Q_PROPERTY(bool useAdvancedMovementControls READ useAdvancedMovementControls WRITE setUseAdvancedMovementControls) Q_PROPERTY(bool useAdvancedMovementControls READ useAdvancedMovementControls WRITE setUseAdvancedMovementControls)
@ -380,15 +374,6 @@ public:
Q_INVOKABLE void setHMDLeanRecenterEnabled(bool value) { _hmdLeanRecenterEnabled = value; } Q_INVOKABLE void setHMDLeanRecenterEnabled(bool value) { _hmdLeanRecenterEnabled = value; }
Q_INVOKABLE bool getHMDLeanRecenterEnabled() const { return _hmdLeanRecenterEnabled; } 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(); } bool useAdvancedMovementControls() const { return _useAdvancedMovementControls.get(); }
void setUseAdvancedMovementControls(bool useAdvancedMovementControls) void setUseAdvancedMovementControls(bool useAdvancedMovementControls)
{ _useAdvancedMovementControls.set(useAdvancedMovementControls); } { _useAdvancedMovementControls.set(useAdvancedMovementControls); }
@ -822,8 +807,11 @@ private:
void prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat4& bodySensorMatrix, const glm::mat4& currentBodyMatrix, bool hasDriveInput); void prePhysicsUpdate(MyAvatar& myAvatar, const glm::mat4& bodySensorMatrix, const glm::mat4& currentBodyMatrix, bool hasDriveInput);
glm::mat4 postPhysicsUpdate(const MyAvatar& myAvatar, const glm::mat4& currentBodyMatrix); glm::mat4 postPhysicsUpdate(const MyAvatar& myAvatar, const glm::mat4& currentBodyMatrix);
bool getForceActivateRotation(); bool getForceActivateRotation();
void setForceActivateRotation(bool val);
bool getForceActivateVertical(); bool getForceActivateVertical();
void setForceActivateVertical(bool val);
bool getForceActivateHorizontal(); bool getForceActivateHorizontal();
void setForceActivateHorizontal(bool val);
bool _forceActivateRotation{ false }; bool _forceActivateRotation{ false };
bool _forceActivateVertical{ false }; bool _forceActivateVertical{ false };
bool _forceActivateHorizontal{ false }; bool _forceActivateHorizontal{ false };
@ -862,9 +850,7 @@ private:
mutable std::mutex _controllerPoseMapMutex; mutable std::mutex _controllerPoseMapMutex;
bool _hmdLeanRecenterEnabled = true; bool _hmdLeanRecenterEnabled = true;
bool _hmdVerticalRecenterEnabled = true;
bool _hmdHorizontalRecenterEnabled = true;
bool _hmdRotationRecenterEnabled = true;
AnimPose _prePhysicsRoomPose; AnimPose _prePhysicsRoomPose;
std::mutex _holdActionsMutex; std::mutex _holdActionsMutex;
std::vector<AvatarActionHold*> _holdActions; std::vector<AvatarActionHold*> _holdActions;