testing avatar touch

This commit is contained in:
Jeffrey Ventrella 2013-05-29 16:14:55 -07:00
parent 9f603c3eff
commit 63434da23c
3 changed files with 34 additions and 24 deletions

View file

@ -50,6 +50,8 @@
using namespace std; using namespace std;
const bool TESTING_AVATAR_TOUCH = true;
// Starfield information // Starfield information
static char STAR_FILE[] = "https://s3-us-west-1.amazonaws.com/highfidelity/stars.txt"; static char STAR_FILE[] = "https://s3-us-west-1.amazonaws.com/highfidelity/stars.txt";
static char STAR_CACHE_FILE[] = "cachedStars.txt"; static char STAR_CACHE_FILE[] = "cachedStars.txt";
@ -915,29 +917,36 @@ void Application::idle() {
_myAvatar.simulate(deltaTime, NULL); _myAvatar.simulate(deltaTime, NULL);
} }
if (_myCamera.getMode() != CAMERA_MODE_MIRROR && !OculusManager::isConnected()) { if ( TESTING_AVATAR_TOUCH) {
if (_manualFirstPerson) { if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) {
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON ) { _myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON); _myCamera.setModeShiftRate(1.0f);
_myCamera.setModeShiftRate(1.0f); }
} } else {
} else { if (_myCamera.getMode() != CAMERA_MODE_MIRROR && !OculusManager::isConnected()) {
if (_manualFirstPerson) {
if (_myAvatar.getIsNearInteractingOther()) { if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON ) {
if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON); _myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
_myCamera.setModeShiftRate(1.0f); _myCamera.setModeShiftRate(1.0f);
} }
} } else {
else {
if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) { if (_myAvatar.getIsNearInteractingOther()) {
_myCamera.setMode(CAMERA_MODE_THIRD_PERSON); if (_myCamera.getMode() != CAMERA_MODE_FIRST_PERSON) {
_myCamera.setModeShiftRate(1.0f); _myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
_myCamera.setModeShiftRate(1.0f);
}
}
else {
if (_myCamera.getMode() != CAMERA_MODE_THIRD_PERSON) {
_myCamera.setMode(CAMERA_MODE_THIRD_PERSON);
_myCamera.setModeShiftRate(1.0f);
}
} }
} }
} }
} }
// Update audio stats for procedural sounds // Update audio stats for procedural sounds
#ifndef _WIN32 #ifndef _WIN32
_audio.setLastAcceleration(_myAvatar.getThrust()); _audio.setLastAcceleration(_myAvatar.getThrust());

View file

@ -37,11 +37,11 @@ const float YOUR_HAND_HOLDING_PULL = 1.0;
const float BODY_SPRING_DEFAULT_TIGHTNESS = 1000.0f; const float BODY_SPRING_DEFAULT_TIGHTNESS = 1000.0f;
const float BODY_SPRING_FORCE = 300.0f; const float BODY_SPRING_FORCE = 300.0f;
const float BODY_SPRING_DECAY = 16.0f; const float BODY_SPRING_DECAY = 16.0f;
const float COLLISION_RADIUS_SCALAR = 1.8; const float COLLISION_RADIUS_SCALAR = 1.8; //pertains to avatar-to-avatar collisions
const float COLLISION_BALL_FORCE = 1.0; const float COLLISION_BALL_FORCE = 1.0; //pertains to avatar-to-avatar collisions
const float COLLISION_BODY_FORCE = 6.0; const float COLLISION_BODY_FORCE = 6.0; //pertains to avatar-to-avatar collisions
const float COLLISION_BALL_FRICTION = 60.0; const float COLLISION_BALL_FRICTION = 60.0; //pertains to avatar-to-avatar collisions
const float COLLISION_BODY_FRICTION = 0.5; const float COLLISION_BODY_FRICTION = 0.5; //pertains to avatar-to-avatar collisions
const float HEAD_ROTATION_SCALE = 0.70; const float HEAD_ROTATION_SCALE = 0.70;
const float HEAD_ROLL_SCALE = 0.40; const float HEAD_ROLL_SCALE = 0.40;
const float HEAD_MAX_PITCH = 45; const float HEAD_MAX_PITCH = 45;
@ -689,6 +689,8 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime
for (int o=b+1; o<NUM_AVATAR_JOINTS; o++) { for (int o=b+1; o<NUM_AVATAR_JOINTS; o++) {
if (otherAvatar->_joint[o].isCollidable) { if (otherAvatar->_joint[o].isCollidable) {
/*
glm::vec3 vectorBetweenJoints(_joint[b].springyPosition - otherAvatar->_joint[o].springyPosition); glm::vec3 vectorBetweenJoints(_joint[b].springyPosition - otherAvatar->_joint[o].springyPosition);
float distanceBetweenJoints = glm::length(vectorBetweenJoints); float distanceBetweenJoints = glm::length(vectorBetweenJoints);
@ -718,12 +720,13 @@ void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime
}// check for collision }// check for collision
} // to avoid divide by zero } // to avoid divide by zero
*/
} // o loop } // o loop
} // collidable } // collidable
} // b loop } // b loop
} // collidable } // collidable
//apply forces and frictions on the bodies of both avatars //apply forces and frictions on the bodies of both avatars
_velocity += bodyPushForce; _velocity += bodyPushForce;
otherAvatar->_velocity -= bodyPushForce; otherAvatar->_velocity -= bodyPushForce;

View file

@ -54,8 +54,6 @@ void AvatarTouch::simulate (float deltaTime) {
facingEachOther = true; facingEachOther = true;
} }
///udhfhduf
if (distanceBetweenBodies < _reachableRadius) if (distanceBetweenBodies < _reachableRadius)
//&& (facingEachOther)) //&& (facingEachOther))
{ {