Fixes in merge.

This commit is contained in:
Philip Rosedale 2013-05-07 08:40:11 -07:00
commit c7635604a9
8 changed files with 312 additions and 270 deletions

View file

@ -34,10 +34,6 @@ const float BODY_ROLL_WHILE_TURNING = 0.1;
const float LIN_VEL_DECAY = 5.0;
const float MY_HAND_HOLDING_PULL = 0.2;
const float YOUR_HAND_HOLDING_PULL = 1.0;
//const float BODY_SPRING_DEFAULT_TIGHTNESS = 20.0f;
//const float BODY_SPRING_FORCE = 6.0f;
const float BODY_SPRING_DEFAULT_TIGHTNESS = 1500.0f;
const float BODY_SPRING_FORCE = 300.0f;
@ -144,13 +140,14 @@ Avatar::Avatar(bool isMine) {
_renderYaw = 0.0;
_renderPitch = 0.0;
_sphere = NULL;
_interactingOther = NULL;
_handHoldingPosition = glm::vec3(0.0f, 0.0f, 0.0f);
_distanceToNearestAvatar = std::numeric_limits<float>::max();
_gravity = glm::vec3(0.0f, -1.0f, 0.0f); // default
initializeSkeleton();
_avatarTouch.setReachableRadius(0.6);
if (iris_texture.size() == 0) {
switchToResourcesParentIfRequired();
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
@ -295,7 +292,6 @@ void Avatar::UpdateGyros(float frametime, SerialInterface* serialInterface, glm:
if ((_headYaw < MAX_YAW) && (_headYaw > MIN_YAW)) {
addHeadYaw(_head.yawRate * HEAD_ROTATION_SCALE * frametime);
}
}
float Avatar::getAbsoluteHeadYaw() const {
@ -316,16 +312,14 @@ void Avatar::setLeanSideways(float dist){
_head.leanSideways = dist;
}
void Avatar::setMousePressed(bool d) {
_mousePressed = d;
void Avatar::setMousePressed(bool mousePressed) {
_mousePressed = mousePressed;
}
bool Avatar::getIsNearInteractingOther() {
return _avatarTouch.getAbleToReachOtherAvatar();
}
void Avatar::simulate(float deltaTime) {
@ -335,9 +329,15 @@ void Avatar::simulate(float deltaTime) {
// update avatar skeleton
updateSkeleton();
//detect and respond to collisions with other avatars...
if (_isMine) {
updateAvatarCollisions(deltaTime);
}
//update the movement of the hand and process handshaking with other avatars...
updateHandMovementAndTouching(deltaTime);
_avatarTouch.simulate(deltaTime);
// apply gravity and collision with the ground/floor
if (USING_AVATAR_GRAVITY) {
@ -430,8 +430,6 @@ void Avatar::simulate(float deltaTime) {
}
//update the movement of the hand and process handshaking with other avatars...
void Avatar::updateHandMovementAndTouching(float deltaTime) {
// reset hand and arm positions according to hand movement
@ -442,33 +440,19 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) {
_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position += transformedHandMovement;
if (_isMine) {
_handState = _mousePressed;
}
//reset these for the next go-round
_avatarTouch.setAbleToReachOtherAvatar (false);
_avatarTouch.setHandsCloseEnoughToGrasp(false);
// if the avatar being simulated is mine, then loop through
// all the other avatars for potential interactions...
if (_isMine)
{
// Reset detector for nearest avatar
_distanceToNearestAvatar = std::numeric_limits<float>::max();
_avatarTouch.setMyBodyPosition(_position);
Avatar * _interactingOther = NULL;
float closestDistance = std::numeric_limits<float>::max();
//loop through all the other avatars for potential interactions...
AgentList* agentList = AgentList::getInstance();
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
Avatar *otherAvatar = (Avatar *)agent->getLinkedData();
// check for collisions with other avatars and respond
updateCollisionWithOtherAvatar(otherAvatar, deltaTime );
// test other avatar hand position for proximity
glm::vec3 v(_joint[ AVATAR_JOINT_RIGHT_SHOULDER ].position);
v -= otherAvatar->getJointPosition(AVATAR_JOINT_RIGHT_SHOULDER);
/*
// Test: Show angle between your fwd vector and nearest avatar
glm::vec3 vectorBetweenUs = otherAvatar->getJointPosition(AVATAR_JOINT_PELVIS) -
@ -477,75 +461,45 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) {
printLog("Angle between: %f\n", angleBetween(&vectorBetweenUs, &myForwardVector));
*/
// test whether shoulders are close enough to allow for reaching to touch hands
glm::vec3 v(_position - otherAvatar->_position);
float distance = glm::length(v);
if (distance < _distanceToNearestAvatar) {_distanceToNearestAvatar = distance;}
if (distance < _maxArmLength + _maxArmLength) {
if (distance < closestDistance) {
closestDistance = distance;
_interactingOther = otherAvatar;
if (! _avatarTouch.getAbleToReachOtherAvatar()) {
//initialize _handHolding
_handHoldingPosition = _joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position;
_avatarTouch.setAbleToReachOtherAvatar(true);
}
glm::vec3 vectorBetweenHands(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
vectorBetweenHands -= otherAvatar->getJointPosition(AVATAR_JOINT_RIGHT_FINGERTIPS);
float distanceBetweenHands = glm::length(vectorBetweenHands);
if (distanceBetweenHands < HANDS_CLOSE_ENOUGH_TO_GRASP) {
_avatarTouch.setHandsCloseEnoughToGrasp(true);
}
// if I am holding hands with another avatar, a force is applied
if ((_handState == 1) || (_interactingOther->_handState == 1)) {
// if the hands are close enough to grasp...
if (distanceBetweenHands < HANDS_CLOSE_ENOUGH_TO_GRASP)
{
// apply the forces...
glm::vec3 vectorToOtherHand = _interactingOther->_handPosition - _handHoldingPosition;
glm::vec3 vectorToMyHand = _joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position - _handHoldingPosition;
_handHoldingPosition += vectorToOtherHand * YOUR_HAND_HOLDING_PULL;
_handHoldingPosition += vectorToMyHand * MY_HAND_HOLDING_PULL;
_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = _handHoldingPosition;
// apply a force to the avatar body
if (glm::length(vectorToOtherHand) > _maxArmLength * 0.9) {
_velocity += vectorToOtherHand;
}
}
}
}
}
}
// Set the vector we send for hand position to other people to be our right hand
setHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
if (_interactingOther) {
_avatarTouch.setYourBodyPosition(_interactingOther->_position);
_avatarTouch.setYourHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].springyPosition);
_avatarTouch.setYourHandState (_interactingOther->_handState);
}
}//if (_isMine)
//constrain right arm length and re-adjust elbow position as it bends
// NOTE - the following must be called on all avatars - not just _isMine
updateArmIKAndConstraints(deltaTime);
// set hand positions for _avatarTouch.setMyHandPosition AFTER calling updateArmIKAndConstraints
if (_interactingOther) {
if (_isMine) {
_avatarTouch.setMyHandPosition (_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
_avatarTouch.setYourHandPosition(_interactingOther->_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
//Set the vector we send for hand position to other people to be our right hand
setHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
if (_mousePressed) {
_handState = 1;
} else {
_handState = 0;
}
_avatarTouch.setMyHandState(_handState);
_avatarTouch.setYourHandState (_interactingOther->_handState);
_avatarTouch.simulate(deltaTime);
}
}
if (!_avatarTouch.getAbleToReachOtherAvatar() ) {
_interactingOther = NULL;
if (_handState == 1) {
_avatarTouch.setMyHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].springyPosition);
}
}
}
void Avatar::updateHead(float deltaTime) {
@ -698,12 +652,43 @@ void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float d
}
//detect collisions with other avatars and respond
void Avatar::updateCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) {
void Avatar::updateAvatarCollisions(float deltaTime) {
// Reset detector for nearest avatar
_distanceToNearestAvatar = std::numeric_limits<float>::max();
//loop through all the other avatars for potential interactions...
AgentList* agentList = AgentList::getInstance();
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
Avatar *otherAvatar = (Avatar *)agent->getLinkedData();
// check if the bounding spheres of the two avatars are colliding
glm::vec3 vectorBetweenBoundingSpheres(_position - otherAvatar->_position);
if (glm::length(vectorBetweenBoundingSpheres) < _height * ONE_HALF + otherAvatar->_height * ONE_HALF) {
//apply forces from collision
applyCollisionWithOtherAvatar(otherAvatar, deltaTime );
}
// test other avatar hand position for proximity
glm::vec3 v(_joint[ AVATAR_JOINT_RIGHT_SHOULDER ].position);
v -= otherAvatar->getPosition();
float distance = glm::length(v);
if (distance < _distanceToNearestAvatar) {
_distanceToNearestAvatar = distance;
}
}
}
}
//detect collisions with other avatars and respond
void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) {
float bodyMomentum = 1.0f;
glm::vec3 bodyPushForce = glm::vec3(0.0f, 0.0f, 0.0f);
@ -755,9 +740,8 @@ void Avatar::updateCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTim
otherAvatar->_velocity -= bodyPushForce;
_velocity *= bodyMomentum;
otherAvatar->_velocity *= bodyMomentum;
}
} // bounding sphere collision
} //method
void Avatar::setDisplayingHead(bool displayingHead ) {
@ -776,7 +760,7 @@ void Avatar::setGravity(glm::vec3 gravity) {
}
void Avatar::render(bool lookingInMirror) {
void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
// render a simple round on the ground projected down from the avatar's position
renderDiskShadow(_position, glm::vec3(0.0f, 1.0f, 0.0f ), 0.1f, 0.2f );
@ -811,7 +795,7 @@ void Avatar::render(bool lookingInMirror) {
// if this is my avatar, then render my interactions with the other avatar
if (_isMine ) {
_avatarTouch.render();
_avatarTouch.render(cameraPosition);
}
// Render the balls
@ -1201,6 +1185,9 @@ void Avatar::initializeSkeleton() {
// generate world positions
updateSkeleton();
//set spring positions to be in the skeleton bone positions
initializeBodySprings();
}
void Avatar::calculateBoneLengths() {

View file

@ -101,13 +101,6 @@ public:
void setLeanForward(float dist);
void setLeanSideways(float dist);
void addLean(float x, float z);
/*
const glm::vec3& getHeadRightDirection() const { return _orientation.getRight(); };
const glm::vec3& getHeadUpDirection () const { return _orientation.getUp (); };
const glm::vec3& getHeadFrontDirection() const { return _orientation.getFront(); };
*/
const glm::vec3& getHeadPosition() const ;
const glm::vec3& getJointPosition(AvatarJointID j) const { return _joint[j].position; };
const glm::vec3& getBodyUpDirection() const { return _orientation.getUp(); };
@ -118,7 +111,7 @@ public:
AvatarMode getMode();
void setMousePressed(bool pressed);
void render(bool lookingInMirror);
void render(bool lookingInMirrorm, glm::vec3 cameraPosition);
void renderBody();
void renderHead(bool lookingInMirror);
void simulate(float);
@ -241,7 +234,6 @@ private:
float _transmitterHz;
int _transmitterPackets;
glm::vec3 _transmitterInitialReading;
Avatar* _interactingOther;
float _pelvisStandingHeight;
float _height;
Balls* _balls;
@ -260,8 +252,9 @@ private:
void readSensors();
void updateHead( float deltaTime );
void updateHandMovementAndTouching(float deltaTime);
void updateAvatarCollisions(float deltaTime);
void updateCollisionWithSphere( glm::vec3 position, float radius, float deltaTime );
void updateCollisionWithOtherAvatar( Avatar * other, float deltaTime );
void applyCollisionWithOtherAvatar( Avatar * other, float deltaTime );
void setHeadFromGyros(glm::vec3 * eulerAngles, glm::vec3 * angularVelocity, float deltaTime, float smoothingTime);
void setHeadSpringScale(float s) { _head.returnSpringScale = s; }
};

View file

@ -16,13 +16,4 @@ AvatarRenderer::AvatarRenderer() {
// this method renders the avatar
void AvatarRenderer::render(Avatar *avatar, bool lookingInMirror) {
/*
// show avatar position
glColor4f( 0.5f, 0.5f, 0.5f, 0.6 );
glPushMatrix();
glTranslatef(avatar->_position.x, avatar->_position.y, avatar->_position.z);
glScalef( 0.03, 0.03, 0.03 );
glutSolidSphere( 1, 10, 10 );
glPopMatrix();
*/
}

View file

@ -10,6 +10,7 @@
#include <SharedUtil.h>
#include "AvatarTouch.h"
#include "InterfaceConfig.h"
#include "Util.h"
const float THREAD_RADIUS = 0.012;
@ -17,8 +18,11 @@ AvatarTouch::AvatarTouch() {
_myHandPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
_yourHandPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
_myBodyPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
_yourBodyPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
_myHandState = 0;
_yourHandState = 0;
_reachableRadius = 0.0f;
_canReachToOtherAvatar = false;
_handsCloseEnoughToGrasp = false;
@ -36,6 +40,14 @@ void AvatarTouch::setYourHandPosition( glm::vec3 position ) {
_yourHandPosition = position;
}
void AvatarTouch::setMyBodyPosition(glm::vec3 position) {
_myBodyPosition = position;
}
void AvatarTouch::setYourBodyPosition(glm::vec3 position) {
_yourBodyPosition = position;
}
void AvatarTouch::setMyHandState(int state) {
_myHandState = state;
}
@ -44,21 +56,19 @@ void AvatarTouch::setYourHandState( int state ) {
_yourHandState = state;
}
void AvatarTouch::render() {
void AvatarTouch::setReachableRadius(float r) {
_reachableRadius = r;
}
glm::vec3 v1( _myHandPosition );
glm::vec3 v2( _yourHandPosition );
void AvatarTouch::render(glm::vec3 cameraPosition) {
if (_canReachToOtherAvatar) {
// if my hand is grasping, show it...
if ( _myHandState == 1 ) {
glPushMatrix();
glTranslatef(_myHandPosition.x, _myHandPosition.y, _myHandPosition.z);
glColor4f( 1.0, 1.0, 0.8, 0.3 ); glutSolidSphere( 0.020f, 10.0f, 10.0f );
glColor4f( 1.0, 1.0, 0.4, 0.2 ); glutSolidSphere( 0.025f, 10.0f, 10.0f );
glColor4f( 1.0, 1.0, 0.2, 0.1 ); glutSolidSphere( 0.030f, 10.0f, 10.0f );
glPopMatrix();
}
glColor4f( 0.3, 0.4, 0.5, 0.5 );
glm::vec3 p(_yourBodyPosition);
p.y = 0.0005f;
renderCircle(p, _reachableRadius, glm::vec3(0.0f, 1.0f, 0.0f), 30);
// if your hand is grasping, show it...
if (_yourHandState == 1) {
@ -69,9 +79,11 @@ void AvatarTouch::render() {
glColor4f( 1.0, 1.0, 0.2, 0.1 ); glutSolidSphere( 0.030f, 10.0f, 10.0f );
glPopMatrix();
}
}
//show beam
glm::vec3 v1(_myHandPosition);
glm::vec3 v2(_yourHandPosition);
if (_handsCloseEnoughToGrasp) {
glLineWidth(2.0);
glColor4f( 0.7f, 0.4f, 0.1f, 0.3 );
@ -90,14 +102,38 @@ void AvatarTouch::render() {
}
}
// if my hand is grasping, show it...
if (_myHandState == 1) {
glPushMatrix();
glTranslatef(_myHandPosition.x, _myHandPosition.y, _myHandPosition.z);
glColor4f( 1.0, 1.0, 0.8, 0.3 ); glutSolidSphere( 0.020f, 10.0f, 10.0f );
glColor4f( 1.0, 1.0, 0.4, 0.2 ); glutSolidSphere( 0.025f, 10.0f, 10.0f );
glColor4f( 1.0, 1.0, 0.2, 0.1 ); glutSolidSphere( 0.030f, 10.0f, 10.0f );
glPopMatrix();
}
}
void AvatarTouch::simulate (float deltaTime) {
glm::vec3 v = _yourHandPosition - _myHandPosition;
glm::vec3 v = _yourBodyPosition - _myBodyPosition;
float distance = glm::length(v);
if (distance < _reachableRadius ) {
_canReachToOtherAvatar = true;
} else {
_canReachToOtherAvatar = false;
}
/*
for (int p=0; p<NUM_POINTS; p++) {
_point[p] = _myHandPosition + v * ( (float)p / (float)NUM_POINTS );
_point[p].x += randFloatInRange( -THREAD_RADIUS, THREAD_RADIUS );
_point[p].y += randFloatInRange( -THREAD_RADIUS, THREAD_RADIUS );
_point[p].z += randFloatInRange( -THREAD_RADIUS, THREAD_RADIUS );
}
*/
}

View file

@ -19,30 +19,35 @@ public:
AvatarTouch();
void simulate(float deltaTime);
void render();
void render(glm::vec3 cameraPosition);
void setMyHandPosition (glm::vec3 position);
void setYourHandPosition(glm::vec3 position);
void setMyBodyPosition (glm::vec3 position);
void setYourBodyPosition(glm::vec3 position);
void setMyHandState (int state);
void setYourHandState (int state);
void setReachableRadius (float r);
void setAbleToReachOtherAvatar (bool a) {_canReachToOtherAvatar = a;}
void setHandsCloseEnoughToGrasp(bool h) {_handsCloseEnoughToGrasp = h;}
bool getAbleToReachOtherAvatar () { return _canReachToOtherAvatar; }
bool getHandsCloseEnoughToGrasp() { return _handsCloseEnoughToGrasp; }
bool getAbleToReachOtherAvatar () const {return _canReachToOtherAvatar;}
bool getHandsCloseEnoughToGrasp() const {return _handsCloseEnoughToGrasp;}
private:
static const int NUM_POINTS = 100;
glm::vec3 _point [NUM_POINTS];
glm::vec3 _myBodyPosition;
glm::vec3 _yourBodyPosition;
glm::vec3 _myHandPosition;
glm::vec3 _yourHandPosition;
int _myHandState;
int _yourHandState;
bool _canReachToOtherAvatar;
bool _handsCloseEnoughToGrasp;
float _reachableRadius;
};
#endif

View file

@ -190,9 +190,7 @@ void drawtext(int x, int y, float scale, float rotate, float thick, int mono,
}
void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec,
float r, float g, float b)
{
void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec, float r, float g, float b) {
//
// Draws text on screen as stroked so it can be resized
//
@ -207,18 +205,15 @@ void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, gl
glLineWidth(thick);
glScalef(scale, scale, 1.0);
len = (int) strlen(vectext);
for (i = 0; i < len; i++)
{
for (i = 0; i < len; i++) {
if (!mono) glutStrokeCharacter(GLUT_STROKE_ROMAN, int(vectext[i]));
else glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, int(vectext[i]));
}
glPopMatrix();
}
void drawGroundPlaneGrid(float size)
{
void drawGroundPlaneGrid(float size) {
glColor3f( 0.4f, 0.5f, 0.3f );
glLineWidth(2.0);
@ -272,6 +267,51 @@ void renderDiskShadow(glm::vec3 position, glm::vec3 upDirection, float radius, f
}
void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition) {
glm::vec3 vectorToPosition(glm::normalize(position - cameraPosition));
glm::vec3 right = glm::cross(vectorToPosition, glm::vec3( 0.0f, 1.0f, 0.0f));
glm::vec3 up = glm::cross(right, vectorToPosition);
glBegin(GL_LINE_STRIP);
for (int i=0; i<numSides+1; i++) {
float r = ((float)i / (float)numSides) * PI * 2.0;
float s = radius * sin(r);
float c = radius * cos(r);
glVertex3f
(
position.x + right.x * s + up.x * c,
position.y + right.y * s + up.y * c,
position.z + right.z * s + up.z * c
);
}
glEnd();
}
void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int numSides ) {
glm::vec3 perp1 = glm::vec3(surfaceNormal.y, surfaceNormal.z, surfaceNormal.x);
glm::vec3 perp2 = glm::vec3(surfaceNormal.z, surfaceNormal.x, surfaceNormal.y);
glBegin(GL_LINE_STRIP);
for (int i=0; i<numSides+1; i++) {
float r = ((float)i / (float)numSides) * PI * 2.0;
float s = radius * sin(r);
float c = radius * cos(r);
glVertex3f
(
position.x + perp1.x * s + perp2.x * c,
position.y + perp1.y * s + perp2.y * c,
position.z + perp1.z * s + perp2.z * c
);
}
glEnd();
}
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) {
glm::vec3 pRight = position + orientation.getRight() * size;
glm::vec3 pUp = position + orientation.getUp() * size;

View file

@ -52,6 +52,9 @@ void renderDiskShadow(glm::vec3 position, glm::vec3 upDirection, float radius, f
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size );
void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition);
void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int numSides );
class oTestCase {
public:

View file

@ -710,7 +710,7 @@ void displaySide(Camera& whichCamera) {
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
Avatar *avatar = (Avatar *)agent->getLinkedData();
avatar->render(0);
avatar->render(0, ::myCamera.getPosition());
}
}
agentList->unlock();
@ -722,7 +722,7 @@ void displaySide(Camera& whichCamera) {
if (::frustumOn) renderViewFrustum(::viewFrustum);
//Render my own avatar
myAvatar.render(::lookingInMirror);
myAvatar.render(::lookingInMirror, ::myCamera.getPosition());
glPopMatrix();
}
@ -1023,23 +1023,11 @@ void display(void)
}
}
/*
if ( ff < 0.8 ) {
myAvatar.setDisplayingHead( true );
} else {
myAvatar.setDisplayingHead( false );
}
*/
//printf( "ff = %f\n", ff );
myCamera.setPitch (thirdPersonPitch + ff * (firstPersonPitch - thirdPersonPitch ));
myCamera.setUpShift (thirdPersonUpShift + ff * (firstPersonUpShift - thirdPersonUpShift ));
myCamera.setDistance (thirdPersonDistance + ff * (firstPersonDistance - thirdPersonDistance ));
myCamera.setTightness (thirdPersonTightness + ff * (firstPersonTightness - thirdPersonTightness));
// this version uses a ramp-up/ramp-down timer in the camera to determine shift between first and thirs-person view
/*
if ( myAvatar.getSpeed() < 0.02 ) {
@ -1079,6 +1067,7 @@ void display(void)
}
// important...
myCamera.update( 1.f/FPS );
// Render anything (like HUD items) that we want to be in 3D but not in worldspace
@ -1679,10 +1668,8 @@ void idle(void) {
myAvatar.setHandMovementValues(handControl.getValues());
// tell my avatar if the mouse is being pressed...
if ( mousePressed == 1 ) {
myAvatar.setMousePressed( true );
} else {
myAvatar.setMousePressed( false );
if (mousePressed) {
myAvatar.setMousePressed(mousePressed);
}
// walking triggers the handControl to stop