resolve conflicts on merge with upstream master

This commit is contained in:
Stephen Birarda 2013-04-25 17:04:18 -07:00
parent e6d278ea12
commit d2714e9321
3 changed files with 33 additions and 58 deletions

View file

@ -59,8 +59,8 @@ Avatar::Avatar(bool isMine) {
//_transmitterTimer = 0; //_transmitterTimer = 0;
_transmitterHz = 0.0; _transmitterHz = 0.0;
_transmitterPackets = 0; _transmitterPackets = 0;
_speed = 0.0;
initializeSkeleton(); _pelvisStandingHeight = 0.0f;
_TEST_bigSphereRadius = 0.3f; _TEST_bigSphereRadius = 0.3f;
_TEST_bigSpherePosition = glm::vec3( 0.0f, _TEST_bigSphereRadius, 2.0f ); _TEST_bigSpherePosition = glm::vec3( 0.0f, _TEST_bigSphereRadius, 2.0f );
@ -315,9 +315,9 @@ void Avatar::simulate(float deltaTime) {
Avatar *otherAvatar = (Avatar *)agent->getLinkedData(); Avatar *otherAvatar = (Avatar *)agent->getLinkedData();
// check for collisions with other avatars and respond // check for collisions with other avatars and respond
updateAvatarCollisionDetectionAndResponse(otherAvatar->getBonePosition(AVATAR_BONE_PELVIS_SPINE), updateAvatarCollisionDetectionAndResponse(otherAvatar->getPosition(),
0.2, 0.1,
0.2, 0.1,
otherAvatar->getBodyUpDirection(), otherAvatar->getBodyUpDirection(),
deltaTime); deltaTime);
@ -326,7 +326,7 @@ void Avatar::simulate(float deltaTime) {
v -= otherAvatar->getBonePosition( AVATAR_BONE_RIGHT_HAND ); v -= otherAvatar->getBonePosition( AVATAR_BONE_RIGHT_HAND );
float distance = glm::length( v ); float distance = glm::length( v );
if ( distance < _maxArmLength ) { if ( distance < _maxArmLength + _maxArmLength ) {
//if ( distance < closestDistance ) { // perhaps I don't need this if we want to allow multi-avatar interactions //if ( distance < closestDistance ) { // perhaps I don't need this if we want to allow multi-avatar interactions
{ {
@ -372,27 +372,12 @@ void Avatar::simulate(float deltaTime) {
if ( AVATAR_GRAVITY ) { if ( AVATAR_GRAVITY ) {
if ( _position.y > _pelvisStandingHeight + 0.01 ) { if ( _position.y > _pelvisStandingHeight + 0.01 ) {
_velocity += glm::dvec3( 0.0, -1.0, 0.0 ) * ( 6.0 * deltaTime );
}
else {
if ( _position.y < _pelvisStandingHeight ) {
_position.y = _pelvisStandingHeight;
_velocity.y = 0.0;
}
}
}
/*
if ( AVATAR_GRAVITY ) {
if ( _position.y > _bone[ AVATAR_BONE_RIGHT_FOOT ].radius * 2.0 ) {
_velocity += glm::dvec3(getGravity(getPosition())) * ( 6.0 * deltaTime ); _velocity += glm::dvec3(getGravity(getPosition())) * ( 6.0 * deltaTime );
} else if ( _position.y < _bone[ AVATAR_BONE_RIGHT_FOOT ].radius ) { } else if ( _position.y < _pelvisStandingHeight ) {
_position.y = _bone[ AVATAR_BONE_RIGHT_FOOT ].radius; _position.y = _pelvisStandingHeight;
_velocity.y = 0.0; _velocity.y = 0.0;
} }
} }
*/
// update body springs // update body springs
updateBodySprings( deltaTime ); updateBodySprings( deltaTime );
@ -428,18 +413,7 @@ void Avatar::simulate(float deltaTime) {
} }
} }
float translationalSpeed = glm::length( _velocity ); // update body yaw by body yaw delta
float rotationalSpeed = fabs( _bodyYawDelta );
if ( translationalSpeed + rotationalSpeed > 0.2 )
{
_mode = AVATAR_MODE_WALKING;
}
else
{
_mode = AVATAR_MODE_INTERACTING;
}
// update body yaw by body yaw delta
if (_isMine) { if (_isMine) {
_bodyYaw += _bodyYawDelta * deltaTime; _bodyYaw += _bodyYawDelta * deltaTime;
} }
@ -553,24 +527,16 @@ void Avatar::simulate(float deltaTime) {
_head.averageLoudness = (1.f - deltaTime / AUDIO_AVERAGING_SECS) * _head.averageLoudness + _head.averageLoudness = (1.f - deltaTime / AUDIO_AVERAGING_SECS) * _head.averageLoudness +
(deltaTime / AUDIO_AVERAGING_SECS) * _audioLoudness; (deltaTime / AUDIO_AVERAGING_SECS) * _audioLoudness;
_speed = glm::length( _velocity ); _speed = glm::length( _velocity );
float rotationalSpeed = fabs( _bodyYawDelta ); float rotationalSpeed = fabs( _bodyYawDelta );
if ( _speed + rotationalSpeed > 0.2 )
{ if ( _speed + rotationalSpeed > 0.2 ) {
_mode = AVATAR_MODE_WALKING; _mode = AVATAR_MODE_WALKING;
} } else {
else
{
_mode = AVATAR_MODE_INTERACTING; _mode = AVATAR_MODE_INTERACTING;
} }
} }
float Avatar::getSpeed() {
return _speed;
}
float Avatar::getGirth() { float Avatar::getGirth() {
return COLLISION_BODY_RADIUS; return COLLISION_BODY_RADIUS;
} }
@ -622,7 +588,7 @@ void Avatar::updateAvatarCollisionDetectionAndResponse(glm::vec3 collisionPositi
} }
void Avatar::render(bool lookingInMirror) { void Avatar::render(bool lookingInMirror) {
/*
// show avatar position // show avatar position
glColor4f( 0.5f, 0.5f, 0.5f, 0.6 ); glColor4f( 0.5f, 0.5f, 0.5f, 0.6 );
glPushMatrix(); glPushMatrix();
@ -908,8 +874,7 @@ void Avatar::initializeSkeleton() {
_bone[ AVATAR_BONE_LEFT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 ); _bone[ AVATAR_BONE_LEFT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 );
_bone[ AVATAR_BONE_RIGHT_CHEST ].defaultPosePosition = glm::vec3( 0.05, 0.05, 0.0 ); _bone[ AVATAR_BONE_RIGHT_CHEST ].defaultPosePosition = glm::vec3( 0.05, 0.05, 0.0 );
_bone[ AVATAR_BONE_RIGHT_SHOULDER ].defaultPosePosition = glm::vec3( 0.03, 0.0, 0.0 ); _bone[ AVATAR_BONE_RIGHT_SHOULDER ].defaultPosePosition = glm::vec3( 0.03, 0.0, 0.0 );
_bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].defaultPosePosition = glm::vec3( 0.0, -0.1, 0.0 ); _bone[ AVATAR_BONE_RIGHT_UPPER_ARM ].defaultPosePosition = glm::vec3( 0.0, -0.1, 0.0 );
_bone[ AVATAR_BONE_RIGHT_FOREARM ].defaultPosePosition = glm::vec3( 0.0, -0.1, 0.0 );
_bone[ AVATAR_BONE_RIGHT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 ); _bone[ AVATAR_BONE_RIGHT_HAND ].defaultPosePosition = glm::vec3( 0.0, -0.05, 0.0 );
_bone[ AVATAR_BONE_LEFT_PELVIS ].defaultPosePosition = glm::vec3( -0.05, 0.0, 0.0 ); _bone[ AVATAR_BONE_LEFT_PELVIS ].defaultPosePosition = glm::vec3( -0.05, 0.0, 0.0 );
_bone[ AVATAR_BONE_LEFT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 ); _bone[ AVATAR_BONE_LEFT_THIGH ].defaultPosePosition = glm::vec3( 0.0, -0.15, 0.0 );
@ -948,6 +913,13 @@ void Avatar::initializeSkeleton() {
// calculate bone length // calculate bone length
calculateBoneLengths(); calculateBoneLengths();
_pelvisStandingHeight =
_bone[ AVATAR_BONE_PELVIS_SPINE ].length +
_bone[ AVATAR_BONE_LEFT_THIGH ].length +
_bone[ AVATAR_BONE_LEFT_SHIN ].length +
_bone[ AVATAR_BONE_LEFT_FOOT ].length +
_bone[ AVATAR_BONE_RIGHT_FOOT ].radius;
// generate world positions // generate world positions
updateSkeleton(); updateSkeleton();
} }

View file

@ -184,6 +184,7 @@ public:
const glm::vec3& getHeadPosition() const ; const glm::vec3& getHeadPosition() const ;
const glm::vec3& getBonePosition(AvatarBoneID b) const { return _bone[b].position; }; const glm::vec3& getBonePosition(AvatarBoneID b) const { return _bone[b].position; };
const glm::vec3& getBodyUpDirection() const { return _orientation.getUp(); }; const glm::vec3& getBodyUpDirection() const { return _orientation.getUp(); };
float getSpeed() const { return _speed; };
float getGirth(); float getGirth();
float getHeight(); float getHeight();
@ -238,6 +239,7 @@ private:
AvatarHandHolding _handHolding; AvatarHandHolding _handHolding;
glm::vec3 _velocity; glm::vec3 _velocity;
glm::vec3 _thrust; glm::vec3 _thrust;
float _speed;
float _maxArmLength; float _maxArmLength;
Orientation _orientation; Orientation _orientation;
int _driveKeys[MAX_DRIVE_KEYS]; int _driveKeys[MAX_DRIVE_KEYS];
@ -249,6 +251,7 @@ private:
int _transmitterPackets; int _transmitterPackets;
Avatar* _interactingOther; Avatar* _interactingOther;
bool _interactingOtherIsNearby; bool _interactingOtherIsNearby;
float _pelvisStandingHeight;
void initializeSkeleton(); void initializeSkeleton();
void updateSkeleton(); void updateSkeleton();

View file

@ -810,10 +810,10 @@ void display(void)
myCamera.setTightness ( 100.0f ); myCamera.setTightness ( 100.0f );
} else { } else {
float firstPersonPitch = 20.0f; // float firstPersonPitch = 20.0f;
float firstPersonUpShift = 0.1f; // float firstPersonUpShift = 0.1f;
float firstPersonDistance = 0.0f; // float firstPersonDistance = 0.0f;
float firstPersonTightness = 100.0f; // float firstPersonTightness = 100.0f;
float thirdPersonPitch = 0.0f; float thirdPersonPitch = 0.0f;
float thirdPersonUpShift = -0.1f; float thirdPersonUpShift = -0.1f;