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

View file

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

View file

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