mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 12:53:03 +02:00
Merge branch 'master' of https://github.com/worklist/hifi
This commit is contained in:
commit
c6a3d702c7
4 changed files with 24 additions and 4 deletions
|
@ -200,7 +200,6 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) {
|
|||
// Compute instantaneous acceleration
|
||||
float forwardAcceleration = glm::length(glm::dot(getBodyFrontDirection(), getVelocity() - oldVelocity)) / deltaTime;
|
||||
const float ACCELERATION_PITCH_DECAY = 0.4f;
|
||||
const float ACCELERATION_YAW_DECAY = 0.4f;
|
||||
const float ACCELERATION_PULL_THRESHOLD = 0.2f;
|
||||
const float OCULUS_ACCELERATION_PULL_THRESHOLD = 1.0f;
|
||||
const int OCULUS_YAW_OFFSET_THRESHOLD = 10;
|
||||
|
@ -210,8 +209,8 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter) {
|
|||
// you start moving, but don't do this with an HMD like the Oculus.
|
||||
if (!OculusManager::isConnected()) {
|
||||
if (forwardAcceleration > ACCELERATION_PULL_THRESHOLD) {
|
||||
_head.setPitch(_head.getPitch() * (1.f - forwardAcceleration * ACCELERATION_PITCH_DECAY * deltaTime));
|
||||
_head.setYaw(_head.getYaw() * (1.f - forwardAcceleration * ACCELERATION_YAW_DECAY * deltaTime));
|
||||
_head.setMousePitch(_head.getMousePitch() * qMax(0.0f,
|
||||
(1.f - forwardAcceleration * ACCELERATION_PITCH_DECAY * deltaTime)));
|
||||
}
|
||||
} else if (fabsf(forwardAcceleration) > OCULUS_ACCELERATION_PULL_THRESHOLD
|
||||
&& fabs(_head.getYaw()) > OCULUS_YAW_OFFSET_THRESHOLD) {
|
||||
|
|
|
@ -95,6 +95,7 @@ void Faceshift::reset() {
|
|||
void Faceshift::updateFakeCoefficients(float leftBlink, float rightBlink, float browUp,
|
||||
float jawOpen, std::vector<float>& coefficients) const {
|
||||
coefficients.resize(max((int)coefficients.size(), _jawOpenIndex + 1));
|
||||
qFill(coefficients.begin(), coefficients.end(), 0.0f);
|
||||
coefficients[_leftBlinkIndex] = leftBlink;
|
||||
coefficients[_rightBlinkIndex] = rightBlink;
|
||||
coefficients[_browUpCenterIndex] = browUp;
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
#include "Application.h"
|
||||
#include "SixenseManager.h"
|
||||
|
||||
SixenseManager::SixenseManager() {
|
||||
using namespace std;
|
||||
|
||||
SixenseManager::SixenseManager() : _lastMovement(0) {
|
||||
#ifdef HAVE_SIXENSE
|
||||
sixenseInit();
|
||||
#endif
|
||||
|
@ -98,6 +100,12 @@ void SixenseManager::update(float deltaTime) {
|
|||
palm->setRawVelocity(rawVelocity); // meters/sec
|
||||
palm->setRawPosition(position);
|
||||
|
||||
// use the velocity to determine whether there's any movement (if the hand isn't new)
|
||||
const float MOVEMENT_SPEED_THRESHOLD = 0.05f;
|
||||
if (glm::length(rawVelocity) > MOVEMENT_SPEED_THRESHOLD && foundHand) {
|
||||
_lastMovement = usecTimestampNow();
|
||||
}
|
||||
|
||||
// initialize the "finger" based on the direction
|
||||
FingerData finger(palm, &hand);
|
||||
finger.setActive(true);
|
||||
|
@ -118,6 +126,14 @@ void SixenseManager::update(float deltaTime) {
|
|||
palm->getFingers().push_back(finger);
|
||||
palm->getFingers().push_back(finger);
|
||||
}
|
||||
|
||||
// if the controllers haven't been moved in a while, disable
|
||||
const int MOVEMENT_DISABLE_DURATION = 30 * 1000 * 1000;
|
||||
if (usecTimestampNow() - _lastMovement > MOVEMENT_DISABLE_DURATION) {
|
||||
for (vector<PalmData>::iterator it = hand.getPalms().begin(); it != hand.getPalms().end(); it++) {
|
||||
it->setActive(false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@ public:
|
|||
public slots:
|
||||
|
||||
void setFilter(bool filter);
|
||||
|
||||
private:
|
||||
|
||||
uint64_t _lastMovement;
|
||||
};
|
||||
|
||||
#endif /* defined(__interface__SixenseManager__) */
|
||||
|
|
Loading…
Reference in a new issue