Add palm velocity

This commit is contained in:
Philip Rosedale 2013-11-29 14:50:18 -08:00
parent 14129cd86d
commit 9680941500
5 changed files with 12 additions and 6 deletions

View file

@ -2221,11 +2221,11 @@ void Application::updateLeap(float deltaTime) {
LeapManager::nextFrame();
}
void Application::updateSixense() {
void Application::updateSixense(float deltaTime) {
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateSixense()");
_sixenseManager.update();
_sixenseManager.update(deltaTime);
}
void Application::updateSerialDevices(float deltaTime) {
@ -2435,7 +2435,7 @@ void Application::update(float deltaTime) {
updateMouseVoxels(deltaTime, mouseRayOrigin, mouseRayDirection, distance, face); // UI/UX related to voxels
updateHandAndTouch(deltaTime); // Update state for touch sensors
updateLeap(deltaTime); // Leap finger-sensing device
updateSixense(); // Razer Hydra controllers
updateSixense(deltaTime); // Razer Hydra controllers
updateSerialDevices(deltaTime); // Read serial port interface devices
updateAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...

View file

@ -247,7 +247,7 @@ private:
glm::vec3& eyePosition);
void updateHandAndTouch(float deltaTime);
void updateLeap(float deltaTime);
void updateSixense();
void updateSixense(float deltaTime);
void updateSerialDevices(float deltaTime);
void updateThreads(float deltaTime);
void updateMyAvatarSimulation(float deltaTime);

View file

@ -25,7 +25,7 @@ SixenseManager::~SixenseManager() {
#endif
}
void SixenseManager::update() {
void SixenseManager::update(float deltaTime) {
#ifdef HAVE_SIXENSE
if (sixenseGetNumActiveControllers() == 0) {
return;
@ -63,6 +63,9 @@ void SixenseManager::update() {
palm.setActive(true);
glm::vec3 position(data.pos[0], data.pos[1], data.pos[2]);
// Compute current velocity from position change
palm.setVelocity((position - palm.getPosition()) / deltaTime);
// Adjust for distance between acquisition 'orb' and the user's torso
// (distance to the right of body center, distance below torso, distance behind torso)
const glm::vec3 SPHERE_TO_TORSO(-250.f, -300.f, -300.f);

View file

@ -16,7 +16,7 @@ public:
SixenseManager();
~SixenseManager();
void update();
void update(float deltaTime);
};
#endif /* defined(__interface__SixenseManager__) */

View file

@ -144,6 +144,8 @@ public:
void setLeapID(int id) { _leapID = id; }
void setRawPosition(const glm::vec3& pos) { _rawPosition = pos; }
void setRawNormal(const glm::vec3& normal) { _rawNormal = normal; }
void setVelocity(const glm::vec3& velocity) { _velocity = velocity; }
const glm::vec3& getVelocity() const { return _velocity; }
void incrementFramesWithoutData() { _numFramesWithoutData++; }
void resetFramesWithoutData() { _numFramesWithoutData = 0; }
@ -153,6 +155,7 @@ private:
std::vector<FingerData> _fingers;
glm::vec3 _rawPosition;
glm::vec3 _rawNormal;
glm::vec3 _velocity;
bool _isActive; // This has current valid data
int _leapID; // the Leap's serial id for this tracked object
int _numFramesWithoutData; // after too many frames without data, this tracked object assumed lost.