mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-09 10:19:36 +02:00
Pulling latest worklist/hifi into local repo
This commit is contained in:
commit
d8e48f8cba
2 changed files with 25 additions and 24 deletions
|
@ -26,11 +26,11 @@
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
const glm::vec3 DEFAULT_UP_DIRECTION(0.0f, 1.0f, 0.0f);
|
const glm::vec3 DEFAULT_UP_DIRECTION(0.0f, 1.0f, 0.0f);
|
||||||
const float YAW_MAG = 500.0;
|
const float YAW_MAG = 500.0f;
|
||||||
const float PITCH_MAG = 100.0f;
|
const float PITCH_MAG = 100.0f;
|
||||||
const float COLLISION_RADIUS_SCALAR = 1.2; // pertains to avatar-to-avatar collisions
|
const float COLLISION_RADIUS_SCALAR = 1.2; // pertains to avatar-to-avatar collisions
|
||||||
const float COLLISION_BALL_FORCE = 200.0; // pertains to avatar-to-avatar collisions
|
const float COLLISION_BALL_FORCE = 200.0f; // pertains to avatar-to-avatar collisions
|
||||||
const float COLLISION_BODY_FORCE = 30.0; // pertains to avatar-to-avatar collisions
|
const float COLLISION_BODY_FORCE = 30.0f; // pertains to avatar-to-avatar collisions
|
||||||
const float COLLISION_RADIUS_SCALE = 0.125f;
|
const float COLLISION_RADIUS_SCALE = 0.125f;
|
||||||
const float MOUSE_RAY_TOUCH_RANGE = 0.01f;
|
const float MOUSE_RAY_TOUCH_RANGE = 0.01f;
|
||||||
const bool USING_HEAD_LEAN = false;
|
const bool USING_HEAD_LEAN = false;
|
||||||
|
@ -779,7 +779,7 @@ void MyAvatar::updateCollisionWithEnvironment(float deltaTime) {
|
||||||
glm::vec3 up = getBodyUpDirection();
|
glm::vec3 up = getBodyUpDirection();
|
||||||
float radius = _collisionRadius;
|
float radius = _collisionRadius;
|
||||||
const float ENVIRONMENT_SURFACE_ELASTICITY = 1.0f;
|
const float ENVIRONMENT_SURFACE_ELASTICITY = 1.0f;
|
||||||
const float ENVIRONMENT_SURFACE_DAMPING = 0.01;
|
const float ENVIRONMENT_SURFACE_DAMPING = 0.01f;
|
||||||
const float ENVIRONMENT_COLLISION_FREQUENCY = 0.05f;
|
const float ENVIRONMENT_COLLISION_FREQUENCY = 0.05f;
|
||||||
glm::vec3 penetration;
|
glm::vec3 penetration;
|
||||||
if (Application::getInstance()->getEnvironment()->findCapsulePenetration(
|
if (Application::getInstance()->getEnvironment()->findCapsulePenetration(
|
||||||
|
@ -794,8 +794,8 @@ void MyAvatar::updateCollisionWithEnvironment(float deltaTime) {
|
||||||
|
|
||||||
void MyAvatar::updateCollisionWithVoxels(float deltaTime) {
|
void MyAvatar::updateCollisionWithVoxels(float deltaTime) {
|
||||||
float radius = _collisionRadius;
|
float radius = _collisionRadius;
|
||||||
const float VOXEL_ELASTICITY = 1.4f;
|
const float VOXEL_ELASTICITY = 0.4f;
|
||||||
const float VOXEL_DAMPING = 0.0;
|
const float VOXEL_DAMPING = 0.0f;
|
||||||
const float VOXEL_COLLISION_FREQUENCY = 0.5f;
|
const float VOXEL_COLLISION_FREQUENCY = 0.5f;
|
||||||
glm::vec3 penetration;
|
glm::vec3 penetration;
|
||||||
if (Application::getInstance()->getVoxels()->findCapsulePenetration(
|
if (Application::getInstance()->getVoxels()->findCapsulePenetration(
|
||||||
|
|
|
@ -69,9 +69,9 @@ void ParticleCollisionSystem::checkParticle(Particle* particle) {
|
||||||
void ParticleCollisionSystem::updateCollisionWithVoxels(Particle* particle) {
|
void ParticleCollisionSystem::updateCollisionWithVoxels(Particle* particle) {
|
||||||
glm::vec3 center = particle->getPosition() * static_cast<float>(TREE_SCALE);
|
glm::vec3 center = particle->getPosition() * static_cast<float>(TREE_SCALE);
|
||||||
float radius = particle->getRadius() * static_cast<float>(TREE_SCALE);
|
float radius = particle->getRadius() * static_cast<float>(TREE_SCALE);
|
||||||
const float VOXEL_ELASTICITY = 0.4f; // fraction of momentum conserved at collision
|
const float ELASTICITY = 0.4f;
|
||||||
const float VOXEL_DAMPING = 0.0f;
|
const float DAMPING = 0.0f;
|
||||||
const float VOXEL_COLLISION_FREQUENCY = 0.5f;
|
const float COLLISION_FREQUENCY = 0.5f;
|
||||||
glm::vec3 penetration;
|
glm::vec3 penetration;
|
||||||
VoxelDetail* voxelDetails = NULL;
|
VoxelDetail* voxelDetails = NULL;
|
||||||
if (_voxels->findSpherePenetration(center, radius, penetration, (void**)&voxelDetails)) {
|
if (_voxels->findSpherePenetration(center, radius, penetration, (void**)&voxelDetails)) {
|
||||||
|
@ -80,8 +80,8 @@ void ParticleCollisionSystem::updateCollisionWithVoxels(Particle* particle) {
|
||||||
particle->collisionWithVoxel(voxelDetails);
|
particle->collisionWithVoxel(voxelDetails);
|
||||||
|
|
||||||
penetration /= (float)TREE_SCALE;
|
penetration /= (float)TREE_SCALE;
|
||||||
updateCollisionSound(particle, penetration, VOXEL_COLLISION_FREQUENCY);
|
updateCollisionSound(particle, penetration, COLLISION_FREQUENCY);
|
||||||
applyHardCollision(particle, penetration, VOXEL_ELASTICITY, VOXEL_DAMPING);
|
applyHardCollision(particle, penetration, ELASTICITY, DAMPING);
|
||||||
|
|
||||||
delete voxelDetails; // cleanup returned details
|
delete voxelDetails; // cleanup returned details
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,9 @@ void ParticleCollisionSystem::updateCollisionWithVoxels(Particle* particle) {
|
||||||
void ParticleCollisionSystem::updateCollisionWithParticles(Particle* particle) {
|
void ParticleCollisionSystem::updateCollisionWithParticles(Particle* particle) {
|
||||||
glm::vec3 center = particle->getPosition() * static_cast<float>(TREE_SCALE);
|
glm::vec3 center = particle->getPosition() * static_cast<float>(TREE_SCALE);
|
||||||
float radius = particle->getRadius() * static_cast<float>(TREE_SCALE);
|
float radius = particle->getRadius() * static_cast<float>(TREE_SCALE);
|
||||||
const float VOXEL_ELASTICITY = 1.4f;
|
const float ELASTICITY = 1.4f;
|
||||||
const float VOXEL_DAMPING = 0.0f;
|
const float DAMPING = 0.0f;
|
||||||
const float VOXEL_COLLISION_FREQUENCY = 0.5f;
|
const float COLLISION_FREQUENCY = 0.5f;
|
||||||
glm::vec3 penetration;
|
glm::vec3 penetration;
|
||||||
Particle* penetratedParticle;
|
Particle* penetratedParticle;
|
||||||
if (_particles->findSpherePenetration(center, radius, penetration, (void**)&penetratedParticle)) {
|
if (_particles->findSpherePenetration(center, radius, penetration, (void**)&penetratedParticle)) {
|
||||||
|
@ -102,7 +102,8 @@ void ParticleCollisionSystem::updateCollisionWithParticles(Particle* particle) {
|
||||||
penetratedParticle->collisionWithParticle(particle);
|
penetratedParticle->collisionWithParticle(particle);
|
||||||
|
|
||||||
penetration /= (float)TREE_SCALE;
|
penetration /= (float)TREE_SCALE;
|
||||||
updateCollisionSound(particle, penetration, VOXEL_COLLISION_FREQUENCY);
|
updateCollisionSound(particle, penetration, COLLISION_FREQUENCY);
|
||||||
|
|
||||||
// apply a hard collision to both particles of half the penetration each
|
// apply a hard collision to both particles of half the penetration each
|
||||||
|
|
||||||
float particleShare, penetratedParticleShare;
|
float particleShare, penetratedParticleShare;
|
||||||
|
@ -119,8 +120,8 @@ void ParticleCollisionSystem::updateCollisionWithParticles(Particle* particle) {
|
||||||
particleShare = 0.5f;
|
particleShare = 0.5f;
|
||||||
penetratedParticleShare = -0.5f;
|
penetratedParticleShare = -0.5f;
|
||||||
}
|
}
|
||||||
applyHardCollision(particle, penetration * particleShare, VOXEL_ELASTICITY, VOXEL_DAMPING);
|
applyHardCollision(particle, penetration * particleShare, ELASTICITY, DAMPING);
|
||||||
applyHardCollision(penetratedParticle, penetration * penetratedParticleShare, VOXEL_ELASTICITY, VOXEL_DAMPING);
|
applyHardCollision(penetratedParticle, penetration * penetratedParticleShare, ELASTICITY, DAMPING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,9 +135,9 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
|
||||||
//printf("updateCollisionWithAvatars()...\n");
|
//printf("updateCollisionWithAvatars()...\n");
|
||||||
glm::vec3 center = particle->getPosition() * static_cast<float>(TREE_SCALE);
|
glm::vec3 center = particle->getPosition() * static_cast<float>(TREE_SCALE);
|
||||||
float radius = particle->getRadius() * static_cast<float>(TREE_SCALE);
|
float radius = particle->getRadius() * static_cast<float>(TREE_SCALE);
|
||||||
const float VOXEL_ELASTICITY = 1.4f;
|
const float ELASTICITY = 0.4f;
|
||||||
const float VOXEL_DAMPING = 0.0f;
|
const float DAMPING = 0.0f;
|
||||||
const float VOXEL_COLLISION_FREQUENCY = 0.5f;
|
const float COLLISION_FREQUENCY = 0.5f;
|
||||||
glm::vec3 penetration;
|
glm::vec3 penetration;
|
||||||
const PalmData* collidingPalm = NULL;
|
const PalmData* collidingPalm = NULL;
|
||||||
|
|
||||||
|
@ -156,7 +157,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
|
||||||
// TODO: dot collidingPalm and hand velocities and skip collision when they are moving apart.
|
// TODO: dot collidingPalm and hand velocities and skip collision when they are moving apart.
|
||||||
// apply a hard collision when ball collides with hand
|
// apply a hard collision when ball collides with hand
|
||||||
penetration /= (float)TREE_SCALE;
|
penetration /= (float)TREE_SCALE;
|
||||||
updateCollisionSound(particle, penetration, VOXEL_COLLISION_FREQUENCY);
|
updateCollisionSound(particle, penetration, COLLISION_FREQUENCY);
|
||||||
|
|
||||||
// determine if the palm that collided was moving, if so, then we add that palm velocity as well...
|
// determine if the palm that collided was moving, if so, then we add that palm velocity as well...
|
||||||
glm::vec3 addedVelocity = NO_ADDED_VELOCITY;
|
glm::vec3 addedVelocity = NO_ADDED_VELOCITY;
|
||||||
|
@ -172,7 +173,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
|
||||||
penetration /= (float)TREE_SCALE;
|
penetration /= (float)TREE_SCALE;
|
||||||
updateCollisionSound(particle, penetration, VOXEL_COLLISION_FREQUENCY);
|
updateCollisionSound(particle, penetration, VOXEL_COLLISION_FREQUENCY);
|
||||||
glm::vec3 addedVelocity = avatar->getVelocity();
|
glm::vec3 addedVelocity = avatar->getVelocity();
|
||||||
applyHardCollision(particle, penetration, VOXEL_ELASTICITY, VOXEL_DAMPING, addedVelocity);
|
applyHardCollision(particle, penetration, ELASTICITY, DAMPING, addedVelocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +192,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
|
||||||
if (handData->findSpherePenetration(center, radius, penetration, collidingPalm)) {
|
if (handData->findSpherePenetration(center, radius, penetration, collidingPalm)) {
|
||||||
// apply a hard collision when ball collides with hand
|
// apply a hard collision when ball collides with hand
|
||||||
penetration /= (float)TREE_SCALE;
|
penetration /= (float)TREE_SCALE;
|
||||||
updateCollisionSound(particle, penetration, VOXEL_COLLISION_FREQUENCY);
|
updateCollisionSound(particle, penetration, COLLISION_FREQUENCY);
|
||||||
|
|
||||||
// determine if the palm that collided was moving, if so, then we add that palm velocity as well...
|
// determine if the palm that collided was moving, if so, then we add that palm velocity as well...
|
||||||
glm::vec3 addedVelocity = NO_ADDED_VELOCITY;
|
glm::vec3 addedVelocity = NO_ADDED_VELOCITY;
|
||||||
|
@ -201,7 +202,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
|
||||||
addedVelocity = palmVelocity;
|
addedVelocity = palmVelocity;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyHardCollision(particle, penetration, VOXEL_ELASTICITY, VOXEL_DAMPING, addedVelocity);
|
applyHardCollision(particle, penetration, ELASTICITY, DAMPING, addedVelocity);
|
||||||
|
|
||||||
} else if (avatar->findSpherePenetration(center, radius, penetration)) {
|
} else if (avatar->findSpherePenetration(center, radius, penetration)) {
|
||||||
penetration /= (float)TREE_SCALE;
|
penetration /= (float)TREE_SCALE;
|
||||||
|
|
Loading…
Reference in a new issue