mirror of
https://github.com/overte-org/overte.git
synced 2025-08-11 06:22:10 +02:00
Add palm velocity
This commit is contained in:
parent
14129cd86d
commit
9680941500
5 changed files with 12 additions and 6 deletions
|
@ -2221,11 +2221,11 @@ void Application::updateLeap(float deltaTime) {
|
||||||
LeapManager::nextFrame();
|
LeapManager::nextFrame();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateSixense() {
|
void Application::updateSixense(float deltaTime) {
|
||||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
PerformanceWarning warn(showWarnings, "Application::updateSixense()");
|
PerformanceWarning warn(showWarnings, "Application::updateSixense()");
|
||||||
|
|
||||||
_sixenseManager.update();
|
_sixenseManager.update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateSerialDevices(float 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
|
updateMouseVoxels(deltaTime, mouseRayOrigin, mouseRayDirection, distance, face); // UI/UX related to voxels
|
||||||
updateHandAndTouch(deltaTime); // Update state for touch sensors
|
updateHandAndTouch(deltaTime); // Update state for touch sensors
|
||||||
updateLeap(deltaTime); // Leap finger-sensing device
|
updateLeap(deltaTime); // Leap finger-sensing device
|
||||||
updateSixense(); // Razer Hydra controllers
|
updateSixense(deltaTime); // Razer Hydra controllers
|
||||||
updateSerialDevices(deltaTime); // Read serial port interface devices
|
updateSerialDevices(deltaTime); // Read serial port interface devices
|
||||||
updateAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
|
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...
|
updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
|
||||||
|
|
|
@ -247,7 +247,7 @@ private:
|
||||||
glm::vec3& eyePosition);
|
glm::vec3& eyePosition);
|
||||||
void updateHandAndTouch(float deltaTime);
|
void updateHandAndTouch(float deltaTime);
|
||||||
void updateLeap(float deltaTime);
|
void updateLeap(float deltaTime);
|
||||||
void updateSixense();
|
void updateSixense(float deltaTime);
|
||||||
void updateSerialDevices(float deltaTime);
|
void updateSerialDevices(float deltaTime);
|
||||||
void updateThreads(float deltaTime);
|
void updateThreads(float deltaTime);
|
||||||
void updateMyAvatarSimulation(float deltaTime);
|
void updateMyAvatarSimulation(float deltaTime);
|
||||||
|
|
|
@ -25,7 +25,7 @@ SixenseManager::~SixenseManager() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SixenseManager::update() {
|
void SixenseManager::update(float deltaTime) {
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
if (sixenseGetNumActiveControllers() == 0) {
|
if (sixenseGetNumActiveControllers() == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -63,6 +63,9 @@ void SixenseManager::update() {
|
||||||
palm.setActive(true);
|
palm.setActive(true);
|
||||||
glm::vec3 position(data.pos[0], data.pos[1], data.pos[2]);
|
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
|
// Adjust for distance between acquisition 'orb' and the user's torso
|
||||||
// (distance to the right of body center, distance below torso, distance behind 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);
|
const glm::vec3 SPHERE_TO_TORSO(-250.f, -300.f, -300.f);
|
||||||
|
|
|
@ -16,7 +16,7 @@ public:
|
||||||
SixenseManager();
|
SixenseManager();
|
||||||
~SixenseManager();
|
~SixenseManager();
|
||||||
|
|
||||||
void update();
|
void update(float deltaTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* defined(__interface__SixenseManager__) */
|
#endif /* defined(__interface__SixenseManager__) */
|
||||||
|
|
|
@ -144,6 +144,8 @@ public:
|
||||||
void setLeapID(int id) { _leapID = id; }
|
void setLeapID(int id) { _leapID = id; }
|
||||||
void setRawPosition(const glm::vec3& pos) { _rawPosition = pos; }
|
void setRawPosition(const glm::vec3& pos) { _rawPosition = pos; }
|
||||||
void setRawNormal(const glm::vec3& normal) { _rawNormal = normal; }
|
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 incrementFramesWithoutData() { _numFramesWithoutData++; }
|
||||||
void resetFramesWithoutData() { _numFramesWithoutData = 0; }
|
void resetFramesWithoutData() { _numFramesWithoutData = 0; }
|
||||||
|
@ -153,6 +155,7 @@ private:
|
||||||
std::vector<FingerData> _fingers;
|
std::vector<FingerData> _fingers;
|
||||||
glm::vec3 _rawPosition;
|
glm::vec3 _rawPosition;
|
||||||
glm::vec3 _rawNormal;
|
glm::vec3 _rawNormal;
|
||||||
|
glm::vec3 _velocity;
|
||||||
bool _isActive; // This has current valid data
|
bool _isActive; // This has current valid data
|
||||||
int _leapID; // the Leap's serial id for this tracked object
|
int _leapID; // the Leap's serial id for this tracked object
|
||||||
int _numFramesWithoutData; // after too many frames without data, this tracked object assumed lost.
|
int _numFramesWithoutData; // after too many frames without data, this tracked object assumed lost.
|
||||||
|
|
Loading…
Reference in a new issue