fixed sneaky array-out-of-bounds error in avatar bones and cleaned up some of the code for testing hand shake target positions

This commit is contained in:
Jeffrey Ventrella 2013-04-19 12:44:09 -07:00
parent 623c998439
commit d962230556
3 changed files with 33 additions and 29 deletions

View file

@ -121,19 +121,17 @@ Head::Head(bool isMine) {
}
}
for (int o=0; o<NUM_OTHER_AVATARS; o++) {
_DEBUG_otherAvatarListTimer[o] = 0.0f;
_DEBUG_otherAvatarListPosition[o] = glm::vec3( 0.0f, 0.0f, 0.0f );
}
if (_isMine)
{
//--------------------------------------------------
// test... just slam them into random positions...
//--------------------------------------------------
_DEBUG_otherAvatarListPosition[ 0 ] = glm::vec3( 0.0, 0.3, 2.0 );
_DEBUG_otherAvatarListPosition[ 1 ] = glm::vec3( 4.0, 0.3, 2.0 );
_DEBUG_otherAvatarListPosition[ 2 ] = glm::vec3( 2.0, 0.3, 2.0 );
_DEBUG_otherAvatarListPosition[ 3 ] = glm::vec3( 1.0, 0.3, -4.0 );
_DEBUG_otherAvatarListPosition[ 4 ] = glm::vec3( -2.0, 0.3, -2.0 );
_DEBUG_otherAvatarListPosition[ 0 ] = glm::vec3( 0.0f, 0.3f, 2.0f );
_DEBUG_otherAvatarListPosition[ 1 ] = glm::vec3( 4.0f, 0.3f, 2.0f );
_DEBUG_otherAvatarListPosition[ 2 ] = glm::vec3( 2.0f, 0.3f, 2.0f );
_DEBUG_otherAvatarListPosition[ 3 ] = glm::vec3( 1.0f, 0.3f, -4.0f );
_DEBUG_otherAvatarListPosition[ 4 ] = glm::vec3( -2.0f, 0.3f, -2.0f );
}
}
Head::Head(const Head &otherHead) {
@ -1065,7 +1063,10 @@ void Head::updateBodySprings( float deltaTime ) {
float force = ( length - _bone[b].length ) * _springForce * deltaTime;
_bone[ b ].springyVelocity -= springDirection * force;
if ( _bone[b].parent != AVATAR_BONE_NULL ) {
_bone[ _bone[b].parent ].springyVelocity += springDirection * force;
}
}
_bone[b].springyVelocity += ( _bone[b].position - _bone[b].springyPosition ) * _bone[b].springBodyTightness * deltaTime;
@ -1144,6 +1145,7 @@ void Head::updateHandMovement() {
transformedHandMovement += handShakePull;
*/
_bone[ AVATAR_BONE_RIGHT_HAND ].position = _DEBUG_otherAvatarListPosition[ _closestOtherAvatar ];
}
}
@ -1247,23 +1249,27 @@ void Head::renderBody() {
glLineWidth(3.0);
for (int b=1; b<NUM_AVATAR_BONES; b++) {
if ( _bone[b].parent != AVATAR_BONE_NULL ) {
glBegin( GL_LINE_STRIP );
glVertex3fv( &_bone[ _bone[ b ].parent ].springyPosition.x );
glVertex3fv( &_bone[ b ].springyPosition.x );
glEnd();
}
}
}
else {
glColor3fv( skinColor );
glLineWidth(3.0);
for (int b=1; b<NUM_AVATAR_BONES; b++) {
if ( _bone[b].parent != AVATAR_BONE_NULL ) {
glBegin( GL_LINE_STRIP );
glVertex3fv( &_bone[ _bone[ b ].parent ].position.x );
glVertex3fv( &_bone[ b ].position.x);
glEnd();
}
}
}
if (( _usingSprings ) && ( _triggeringAction )) {

View file

@ -214,7 +214,6 @@ class Head : public AvatarData {
glm::vec3 _TEST_bigSpherePosition;
float _TEST_bigSphereRadius;
glm::vec3 _DEBUG_otherAvatarListPosition[ NUM_OTHER_AVATARS ];
float _DEBUG_otherAvatarListTimer [ NUM_OTHER_AVATARS ];
bool _triggeringAction;
float _bodyYawDelta;
float _closeEnoughToInteract;

View file

@ -20,8 +20,7 @@ using avatars_lib::printLog;
//
// tosh - yep, I noticed... :-)
//
// JJV - I noticed too :-)
//
static bool testingForNormalizationAndOrthogonality = false;
Orientation::Orientation() {