mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
Turn off Sixense (kalman?) filtering, cleanup code
This commit is contained in:
parent
c1f96ab6b4
commit
8d518f85fe
2 changed files with 20 additions and 7 deletions
|
@ -15,6 +15,7 @@
|
|||
#include "Util.h"
|
||||
#include "renderer/ProgramObject.h"
|
||||
|
||||
|
||||
using namespace std;
|
||||
|
||||
Hand::Hand(Avatar* owningAvatar) :
|
||||
|
@ -126,18 +127,23 @@ void Hand::simulate(float deltaTime, bool isMine) {
|
|||
}
|
||||
|
||||
void Hand::handleVoxelCollision(PalmData* palm, const glm::vec3& fingerTipPosition, VoxelTreeElement* voxel, float deltaTime) {
|
||||
//
|
||||
// Collision between finger and a voxel plays sound
|
||||
//
|
||||
float volume = 0.1f + glm::clamp(glm::length(palm->getVelocity()), 0.f, 0.9f);
|
||||
const float LOWEST_FREQUENCY = 100.f;
|
||||
const float HERTZ_PER_RGB = 3.f;
|
||||
const float DECAY_PER_SAMPLE = 0.0005f;
|
||||
const float DURATION_MAX = 2.0f;
|
||||
const float MIN_VOLUME = 0.1f;
|
||||
float volume = MIN_VOLUME + glm::clamp(glm::length(palm->getVelocity()), 0.f, (1.f - MIN_VOLUME));
|
||||
float duration = volume;
|
||||
_collisionCenter = fingerTipPosition;
|
||||
_collisionAge = deltaTime;
|
||||
_collisionDuration = duration;
|
||||
int voxelBrightness = voxel->getColor()[0] + voxel->getColor()[1] + voxel->getColor()[2];
|
||||
float frequency = 100.f + (voxelBrightness * 3.f); // Hz
|
||||
// Play a sound
|
||||
Application::getInstance()->getAudio()->startDrumSound(volume, frequency, 2.0f, 0.0005f);
|
||||
float frequency = LOWEST_FREQUENCY + (voxelBrightness * HERTZ_PER_RGB);
|
||||
Application::getInstance()->getAudio()->startDrumSound(volume,
|
||||
frequency,
|
||||
DURATION_MAX,
|
||||
DECAY_PER_SAMPLE);
|
||||
}
|
||||
|
||||
void Hand::calculateGeometry() {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
SixenseManager::SixenseManager() {
|
||||
#ifdef HAVE_SIXENSE
|
||||
sixenseInit();
|
||||
sixenseSetFilterEnabled(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -24,7 +25,7 @@ SixenseManager::~SixenseManager() {
|
|||
sixenseExit();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SixenseManager::update(float deltaTime) {
|
||||
#ifdef HAVE_SIXENSE
|
||||
if (sixenseGetNumActiveControllers() == 0) {
|
||||
|
@ -68,6 +69,12 @@ void SixenseManager::update(float deltaTime) {
|
|||
palm->setControllerButtons(data.buttons);
|
||||
palm->setTrigger(data.trigger);
|
||||
palm->setJoystick(data.joystick_x, data.joystick_y);
|
||||
|
||||
// Vibrate if needed
|
||||
if (palm->getIsCollidingWithVoxel()) {
|
||||
//printf("vibrate!\n");
|
||||
//vibrate(data.controller_index, 100, 1);
|
||||
}
|
||||
|
||||
glm::vec3 position(data.pos[0], data.pos[1], data.pos[2]);
|
||||
// Adjust for distance between acquisition 'orb' and the user's torso
|
||||
|
|
Loading…
Reference in a new issue