mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 04:44:08 +02:00
Touch-driven pitch happens immediately even when wearing gyros
This commit is contained in:
parent
e5de67152e
commit
58cb852597
5 changed files with 8 additions and 7 deletions
|
@ -2587,7 +2587,6 @@ void Application::updateAvatar(float deltaTime) {
|
|||
glm::vec3(_headCameraPitchYawScale,
|
||||
_headCameraPitchYawScale,
|
||||
_headCameraPitchYawScale),
|
||||
0.f,
|
||||
_pitchFromTouch);
|
||||
|
||||
if (_serialHeadSensor.isActive()) {
|
||||
|
|
|
@ -295,8 +295,8 @@ void Avatar::reset() {
|
|||
// Update avatar head rotation with sensor data
|
||||
void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook,
|
||||
const glm::vec3& amplifyAngle,
|
||||
float yawFromTouch,
|
||||
float pitchFromTouch) {
|
||||
_head.setMousePitch(pitchFromTouch);
|
||||
SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor();
|
||||
Webcam* webcam = Application::getInstance()->getWebcam();
|
||||
glm::vec3 estimatedPosition, estimatedRotation;
|
||||
|
@ -308,7 +308,6 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook,
|
|||
|
||||
} else {
|
||||
_head.setPitch(pitchFromTouch);
|
||||
_head.setYaw(yawFromTouch);
|
||||
return;
|
||||
}
|
||||
if (webcam->isActive()) {
|
||||
|
@ -334,8 +333,8 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook,
|
|||
} else {
|
||||
_head.getFace().clearFrame();
|
||||
}
|
||||
_head.setPitch(estimatedRotation.x * amplifyAngle.x + pitchFromTouch);
|
||||
_head.setYaw(estimatedRotation.y * amplifyAngle.y + yawFromTouch);
|
||||
_head.setPitch(estimatedRotation.x * amplifyAngle.x);
|
||||
_head.setYaw(estimatedRotation.y * amplifyAngle.y);
|
||||
_head.setRoll(estimatedRotation.z * amplifyAngle.z);
|
||||
_head.setCameraFollowsHead(gyroLook);
|
||||
|
||||
|
|
|
@ -124,7 +124,6 @@ public:
|
|||
void follow(Avatar* leadingAvatar);
|
||||
void updateFromGyrosAndOrWebcam(bool gyroLook,
|
||||
const glm::vec3& amplifyAngle,
|
||||
float yawFromTouch,
|
||||
float pitchFromTouch);
|
||||
void addBodyYaw(float bodyYaw) {_bodyYaw += bodyYaw;};
|
||||
void addBodyYawDelta(float bodyYawDelta) {_bodyYawDelta += bodyYawDelta;}
|
||||
|
|
|
@ -84,6 +84,7 @@ Head::Head(Avatar* owningAvatar) :
|
|||
_rightEyeBlinkVelocity(0.0f),
|
||||
_timeWithoutTalking(0.0f),
|
||||
_cameraPitch(_pitch),
|
||||
_mousePitch(0.f),
|
||||
_cameraYaw(_yaw),
|
||||
_isCameraMoving(false),
|
||||
_cameraFollowsHead(false),
|
||||
|
@ -428,7 +429,7 @@ glm::quat Head::getOrientation() const {
|
|||
glm::quat Head::getCameraOrientation () const {
|
||||
Avatar* owningAvatar = static_cast<Avatar*>(_owningAvatar);
|
||||
return owningAvatar->getWorldAlignedOrientation()
|
||||
* glm::quat(glm::radians(glm::vec3(_cameraPitch, _cameraYaw, 0.0f)));
|
||||
* glm::quat(glm::radians(glm::vec3(_cameraPitch + _mousePitch, _cameraYaw, 0.0f)));
|
||||
}
|
||||
|
||||
void Head::renderHeadSphere() {
|
||||
|
|
|
@ -57,6 +57,8 @@ public:
|
|||
|
||||
void setCameraFollowsHead(bool cameraFollowsHead) { _cameraFollowsHead = cameraFollowsHead; }
|
||||
|
||||
void setMousePitch(float mousePitch) { _mousePitch = mousePitch; }
|
||||
|
||||
glm::quat getOrientation() const;
|
||||
glm::quat getCameraOrientation () const;
|
||||
|
||||
|
@ -123,6 +125,7 @@ private:
|
|||
float _rightEyeBlinkVelocity;
|
||||
float _timeWithoutTalking;
|
||||
float _cameraPitch; // Used to position the camera differently from the head
|
||||
float _mousePitch;
|
||||
float _cameraYaw;
|
||||
bool _isCameraMoving;
|
||||
bool _cameraFollowsHead;
|
||||
|
|
Loading…
Reference in a new issue