mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 08:04:01 +02:00
Fix for camera movement with webcam enabled; don't bother using roll from
webcam if we have the gyros; reinstate head orientation scaling; don't bother using gyro position.
This commit is contained in:
parent
e85f498ef3
commit
b660336b2a
3 changed files with 7 additions and 11 deletions
|
@ -363,7 +363,7 @@ void Application::paintGL() {
|
|||
glEnable(GL_LINE_SMOOTH);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
float headCameraScale = _serialHeadSensor.isActive() ? _headCameraPitchYawScale : 1.0f;
|
||||
float headCameraScale = (_serialHeadSensor.isActive() || _webcam.isActive()) ? _headCameraPitchYawScale : 1.0f;
|
||||
|
||||
if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
|
||||
_myCamera.setTightness (100.0f);
|
||||
|
|
|
@ -286,15 +286,17 @@ void Avatar::reset() {
|
|||
|
||||
// Update avatar head rotation with sensor data
|
||||
void Avatar::updateHeadFromGyrosAndOrWebcam() {
|
||||
const float AMPLIFY_PITCH = 1.f;
|
||||
const float AMPLIFY_YAW = 1.f;
|
||||
const float AMPLIFY_ROLL = 1.f;
|
||||
const float AMPLIFY_PITCH = 2.f;
|
||||
const float AMPLIFY_YAW = 2.f;
|
||||
const float AMPLIFY_ROLL = 2.f;
|
||||
|
||||
SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor();
|
||||
Webcam* webcam = Application::getInstance()->getWebcam();
|
||||
glm::vec3 estimatedPosition, estimatedRotation;
|
||||
if (gyros->isActive()) {
|
||||
estimatedPosition = gyros->getEstimatedPosition();
|
||||
if (webcam->isActive()) {
|
||||
estimatedPosition = webcam->getEstimatedPosition();
|
||||
}
|
||||
estimatedRotation = gyros->getEstimatedRotation();
|
||||
|
||||
} else if (webcam->isActive()) {
|
||||
|
|
|
@ -341,12 +341,6 @@ void SerialInterface::readData(float deltaTime) {
|
|||
|
||||
_estimatedRotation = safeEulerAngles(estimatedRotation);
|
||||
|
||||
// Fuse gyro roll with webcam roll
|
||||
if (webcam->isActive()) {
|
||||
_estimatedRotation.z = glm::mix(_estimatedRotation.z, webcam->getEstimatedRotation().z,
|
||||
1.0f / SENSOR_FUSION_SAMPLES);
|
||||
}
|
||||
|
||||
totalSamples++;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue