mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 20:36:38 +02:00
Added "Standing HMD Sensor Mode" checkbox to menu
removed static bool isRoomTracking and instead moved into the View menu.
This commit is contained in:
parent
158c1c6aa8
commit
9209e0745e
6 changed files with 35 additions and 18 deletions
|
@ -687,6 +687,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
|
auto applicationUpdater = DependencyManager::get<AutoUpdater>();
|
||||||
connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
|
connect(applicationUpdater.data(), &AutoUpdater::newVersionIsAvailable, dialogsManager.data(), &DialogsManager::showUpdateDialog);
|
||||||
applicationUpdater->checkForUpdate();
|
applicationUpdater->checkForUpdate();
|
||||||
|
|
||||||
|
// Now that menu is initalized we can sync myAvatar with it's state.
|
||||||
|
_myAvatar->updateMotionBehaviorFromMenu();
|
||||||
|
_myAvatar->updateStandingHMDModeFromMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::aboutToQuit() {
|
void Application::aboutToQuit() {
|
||||||
|
|
|
@ -244,16 +244,16 @@ Menu::Menu() {
|
||||||
SLOT(resetSize()));
|
SLOT(resetSize()));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::KeyboardMotorControl,
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::KeyboardMotorControl,
|
||||||
Qt::CTRL | Qt::SHIFT | Qt::Key_K, true, avatar, SLOT(updateMotionBehavior()));
|
Qt::CTRL | Qt::SHIFT | Qt::Key_K, true, avatar, SLOT(updateMotionBehaviorFromMenu()));
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ScriptedMotorControl, 0, true,
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ScriptedMotorControl, 0, true,
|
||||||
avatar, SLOT(updateMotionBehavior()));
|
avatar, SLOT(updateMotionBehaviorFromMenu()));
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::NamesAboveHeads, 0, true);
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::NamesAboveHeads, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::GlowWhenSpeaking, 0, true);
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::GlowWhenSpeaking, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::BlueSpeechSphere, 0, true);
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::BlueSpeechSphere, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::EnableCharacterController, 0, true,
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::EnableCharacterController, 0, true,
|
||||||
avatar, SLOT(updateMotionBehavior()));
|
avatar, SLOT(updateMotionBehaviorFromMenu()));
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ShiftHipsForIdleAnimations, 0, false,
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ShiftHipsForIdleAnimations, 0, false,
|
||||||
avatar, SLOT(updateMotionBehavior()));
|
avatar, SLOT(updateMotionBehaviorFromMenu()));
|
||||||
|
|
||||||
MenuWrapper* viewMenu = addMenu("View");
|
MenuWrapper* viewMenu = addMenu("View");
|
||||||
{
|
{
|
||||||
|
@ -325,6 +325,9 @@ Menu::Menu() {
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false);
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false);
|
||||||
|
|
||||||
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::StandingHMDSensorMode, 0, false,
|
||||||
|
avatar, SLOT(updateStandingHMDModeFromMenu()));
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats);
|
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats);
|
||||||
addActionToQMenuAndActionHash(viewMenu, MenuOption::Log,
|
addActionToQMenuAndActionHash(viewMenu, MenuOption::Log,
|
||||||
Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
Qt::CTRL | Qt::SHIFT | Qt::Key_L,
|
||||||
|
|
|
@ -273,6 +273,7 @@ namespace MenuOption {
|
||||||
const QString SimpleShadows = "Simple";
|
const QString SimpleShadows = "Simple";
|
||||||
const QString SixenseEnabled = "Enable Hydra Support";
|
const QString SixenseEnabled = "Enable Hydra Support";
|
||||||
const QString ShiftHipsForIdleAnimations = "Shift hips for idle animations";
|
const QString ShiftHipsForIdleAnimations = "Shift hips for idle animations";
|
||||||
|
const QString StandingHMDSensorMode = "Standing HMD Sensor Mode";
|
||||||
const QString Stars = "Stars";
|
const QString Stars = "Stars";
|
||||||
const QString Stats = "Stats";
|
const QString Stats = "Stats";
|
||||||
const QString StopAllScripts = "Stop All Scripts";
|
const QString StopAllScripts = "Stop All Scripts";
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static bool isRoomTracking = true;
|
|
||||||
|
|
||||||
Head::Head(Avatar* owningAvatar) :
|
Head::Head(Avatar* owningAvatar) :
|
||||||
HeadData((AvatarData*)owningAvatar),
|
HeadData((AvatarData*)owningAvatar),
|
||||||
_returnHeadToCenter(false),
|
_returnHeadToCenter(false),
|
||||||
|
@ -120,7 +118,7 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isRoomTracking) {
|
if (!myAvatar->getStandingHMDSensorMode()) {
|
||||||
// Twist the upper body to follow the rotation of the head, but only do this with my avatar,
|
// Twist the upper body to follow the rotation of the head, but only do this with my avatar,
|
||||||
// since everyone else will see the full joint rotations for other people.
|
// since everyone else will see the full joint rotations for other people.
|
||||||
const float BODY_FOLLOW_HEAD_YAW_RATE = 0.1f;
|
const float BODY_FOLLOW_HEAD_YAW_RATE = 0.1f;
|
||||||
|
@ -342,7 +340,7 @@ glm::quat Head::getCameraOrientation() const {
|
||||||
// always the same.
|
// always the same.
|
||||||
if (qApp->isHMDMode()) {
|
if (qApp->isHMDMode()) {
|
||||||
MyAvatar* myAvatar = dynamic_cast<MyAvatar*>(_owningAvatar);
|
MyAvatar* myAvatar = dynamic_cast<MyAvatar*>(_owningAvatar);
|
||||||
if (isRoomTracking && myAvatar) {
|
if (myAvatar && myAvatar->getStandingHMDSensorMode()) {
|
||||||
return glm::quat_cast(myAvatar->getSensorToWorldMatrix()) * myAvatar->getHMDSensorOrientation();
|
return glm::quat_cast(myAvatar->getSensorToWorldMatrix()) * myAvatar->getHMDSensorOrientation();
|
||||||
} else {
|
} else {
|
||||||
return getOrientation();
|
return getOrientation();
|
||||||
|
|
|
@ -76,8 +76,6 @@ const float MyAvatar::ZOOM_MIN = 0.5f;
|
||||||
const float MyAvatar::ZOOM_MAX = 25.0f;
|
const float MyAvatar::ZOOM_MAX = 25.0f;
|
||||||
const float MyAvatar::ZOOM_DEFAULT = 1.5f;
|
const float MyAvatar::ZOOM_DEFAULT = 1.5f;
|
||||||
|
|
||||||
static bool isRoomTracking = true;
|
|
||||||
|
|
||||||
MyAvatar::MyAvatar() :
|
MyAvatar::MyAvatar() :
|
||||||
Avatar(),
|
Avatar(),
|
||||||
_gravity(0.0f, 0.0f, 0.0f),
|
_gravity(0.0f, 0.0f, 0.0f),
|
||||||
|
@ -109,7 +107,8 @@ MyAvatar::MyAvatar() :
|
||||||
_hmdSensorPosition(),
|
_hmdSensorPosition(),
|
||||||
_bodySensorMatrix(),
|
_bodySensorMatrix(),
|
||||||
_inverseBodySensorMatrix(),
|
_inverseBodySensorMatrix(),
|
||||||
_sensorToWorldMatrix()
|
_sensorToWorldMatrix(),
|
||||||
|
_standingHMDSensorMode(false)
|
||||||
{
|
{
|
||||||
_firstPersonSkeletonModel.setIsFirstPerson(true);
|
_firstPersonSkeletonModel.setIsFirstPerson(true);
|
||||||
|
|
||||||
|
@ -310,7 +309,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
|
|
||||||
Head* head = getHead();
|
Head* head = getHead();
|
||||||
if (inHmd || isPlaying()) {
|
if (inHmd || isPlaying()) {
|
||||||
if (!isRoomTracking) {
|
if (!getStandingHMDSensorMode()) {
|
||||||
head->setDeltaPitch(estimatedRotation.x);
|
head->setDeltaPitch(estimatedRotation.x);
|
||||||
head->setDeltaYaw(estimatedRotation.y);
|
head->setDeltaYaw(estimatedRotation.y);
|
||||||
head->setDeltaRoll(estimatedRotation.z);
|
head->setDeltaRoll(estimatedRotation.z);
|
||||||
|
@ -336,7 +335,7 @@ void MyAvatar::updateFromTrackers(float deltaTime) {
|
||||||
relativePosition.x = -relativePosition.x;
|
relativePosition.x = -relativePosition.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(inHmd && isRoomTracking)) {
|
if (!(inHmd && getStandingHMDSensorMode())) {
|
||||||
head->setLeanSideways(glm::clamp(glm::degrees(atanf(relativePosition.x * _leanScale / TORSO_LENGTH)),
|
head->setLeanSideways(glm::clamp(glm::degrees(atanf(relativePosition.x * _leanScale / TORSO_LENGTH)),
|
||||||
-MAX_LEAN, MAX_LEAN));
|
-MAX_LEAN, MAX_LEAN));
|
||||||
head->setLeanForward(glm::clamp(glm::degrees(atanf(relativePosition.z * _leanScale / TORSO_LENGTH)),
|
head->setLeanForward(glm::clamp(glm::degrees(atanf(relativePosition.z * _leanScale / TORSO_LENGTH)),
|
||||||
|
@ -1313,7 +1312,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
|
||||||
glm::mat4 sensorOffset = bodyMat * glm::mat4_cast(twist) * glm::inverse(bodyMat);
|
glm::mat4 sensorOffset = bodyMat * glm::mat4_cast(twist) * glm::inverse(bodyMat);
|
||||||
_sensorToWorldMatrix = sensorOffset * _sensorToWorldMatrix;
|
_sensorToWorldMatrix = sensorOffset * _sensorToWorldMatrix;
|
||||||
|
|
||||||
if (!(qApp->isHMDMode() && isRoomTracking)) {
|
if (!(qApp->isHMDMode() && getStandingHMDSensorMode())) {
|
||||||
setOrientation(twist * getOrientation());
|
setOrientation(twist * getOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1505,7 +1504,7 @@ void MyAvatar::updatePosition(float deltaTime) {
|
||||||
const float MOVING_SPEED_THRESHOLD = 0.01f;
|
const float MOVING_SPEED_THRESHOLD = 0.01f;
|
||||||
_moving = speed > MOVING_SPEED_THRESHOLD;
|
_moving = speed > MOVING_SPEED_THRESHOLD;
|
||||||
|
|
||||||
if (qApp->isHMDMode() && isRoomTracking) {
|
if (qApp->isHMDMode() && getStandingHMDSensorMode()) {
|
||||||
Avatar::setPosition(getWorldBodyPosition());
|
Avatar::setPosition(getWorldBodyPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1599,7 +1598,7 @@ void MyAvatar::goToLocation(const glm::vec3& newPosition,
|
||||||
qCDebug(interfaceapp).nospace() << "MyAvatar goToLocation - moving to " << newPosition.x << ", "
|
qCDebug(interfaceapp).nospace() << "MyAvatar goToLocation - moving to " << newPosition.x << ", "
|
||||||
<< newPosition.y << ", " << newPosition.z;
|
<< newPosition.y << ", " << newPosition.z;
|
||||||
|
|
||||||
if (qApp->isHMDMode() && isRoomTracking) {
|
if (qApp->isHMDMode() && getStandingHMDSensorMode()) {
|
||||||
// AJT: FIXME, does not work with orientation.
|
// AJT: FIXME, does not work with orientation.
|
||||||
// AJT: FIXME, does not work with shouldFaceLocation flag.
|
// AJT: FIXME, does not work with shouldFaceLocation flag.
|
||||||
// Set the orientation of the sensor room, not the avatar itself.
|
// Set the orientation of the sensor room, not the avatar itself.
|
||||||
|
@ -1631,7 +1630,7 @@ void MyAvatar::goToLocation(const glm::vec3& newPosition,
|
||||||
emit transformChanged();
|
emit transformChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::updateMotionBehavior() {
|
void MyAvatar::updateMotionBehaviorFromMenu() {
|
||||||
Menu* menu = Menu::getInstance();
|
Menu* menu = Menu::getInstance();
|
||||||
if (menu->isOptionChecked(MenuOption::KeyboardMotorControl)) {
|
if (menu->isOptionChecked(MenuOption::KeyboardMotorControl)) {
|
||||||
_motionBehaviors |= AVATAR_MOTION_KEYBOARD_MOTOR_ENABLED;
|
_motionBehaviors |= AVATAR_MOTION_KEYBOARD_MOTOR_ENABLED;
|
||||||
|
@ -1647,6 +1646,11 @@ void MyAvatar::updateMotionBehavior() {
|
||||||
_feetTouchFloor = menu->isOptionChecked(MenuOption::ShiftHipsForIdleAnimations);
|
_feetTouchFloor = menu->isOptionChecked(MenuOption::ShiftHipsForIdleAnimations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyAvatar::updateStandingHMDModeFromMenu() {
|
||||||
|
Menu* menu = Menu::getInstance();
|
||||||
|
_standingHMDSensorMode = menu->isOptionChecked(MenuOption::StandingHMDSensorMode);
|
||||||
|
}
|
||||||
|
|
||||||
//Renders sixense laser pointers for UI selection with controllers
|
//Renders sixense laser pointers for UI selection with controllers
|
||||||
void MyAvatar::renderLaserPointers(gpu::Batch& batch) {
|
void MyAvatar::renderLaserPointers(gpu::Batch& batch) {
|
||||||
const float PALM_TIP_ROD_RADIUS = 0.002f;
|
const float PALM_TIP_ROD_RADIUS = 0.002f;
|
||||||
|
|
|
@ -185,6 +185,8 @@ public:
|
||||||
static const float ZOOM_MAX;
|
static const float ZOOM_MAX;
|
||||||
static const float ZOOM_DEFAULT;
|
static const float ZOOM_DEFAULT;
|
||||||
|
|
||||||
|
bool getStandingHMDSensorMode() const { return _standingHMDSensorMode; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void increaseSize();
|
void increaseSize();
|
||||||
void decreaseSize();
|
void decreaseSize();
|
||||||
|
@ -199,7 +201,8 @@ public slots:
|
||||||
glm::vec3 getThrust() { return _thrust; };
|
glm::vec3 getThrust() { return _thrust; };
|
||||||
void setThrust(glm::vec3 newThrust) { _thrust = newThrust; }
|
void setThrust(glm::vec3 newThrust) { _thrust = newThrust; }
|
||||||
|
|
||||||
void updateMotionBehavior();
|
void updateMotionBehaviorFromMenu();
|
||||||
|
void updateStandingHMDModeFromMenu();
|
||||||
|
|
||||||
glm::vec3 getLeftPalmPosition();
|
glm::vec3 getLeftPalmPosition();
|
||||||
glm::vec3 getRightPalmPosition();
|
glm::vec3 getRightPalmPosition();
|
||||||
|
@ -217,6 +220,8 @@ public slots:
|
||||||
|
|
||||||
virtual void rebuildSkeletonBody();
|
virtual void rebuildSkeletonBody();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void transformChanged();
|
void transformChanged();
|
||||||
void newCollisionSoundURL(const QUrl& url);
|
void newCollisionSoundURL(const QUrl& url);
|
||||||
|
@ -316,6 +321,8 @@ private:
|
||||||
|
|
||||||
// used to transform any sensor into world space, including the _hmdSensorMat, or hand controllers.
|
// used to transform any sensor into world space, including the _hmdSensorMat, or hand controllers.
|
||||||
glm::mat4 _sensorToWorldMatrix;
|
glm::mat4 _sensorToWorldMatrix;
|
||||||
|
|
||||||
|
bool _standingHMDSensorMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_MyAvatar_h
|
#endif // hifi_MyAvatar_h
|
||||||
|
|
Loading…
Reference in a new issue