mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 06:35:07 +02:00
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:
parent
623c998439
commit
d962230556
3 changed files with 33 additions and 29 deletions
|
@ -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...
|
// test... just slam them into random positions...
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
_DEBUG_otherAvatarListPosition[ 0 ] = glm::vec3( 0.0, 0.3, 2.0 );
|
_DEBUG_otherAvatarListPosition[ 0 ] = glm::vec3( 0.0f, 0.3f, 2.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 1 ] = glm::vec3( 4.0, 0.3, 2.0 );
|
_DEBUG_otherAvatarListPosition[ 1 ] = glm::vec3( 4.0f, 0.3f, 2.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 2 ] = glm::vec3( 2.0, 0.3, 2.0 );
|
_DEBUG_otherAvatarListPosition[ 2 ] = glm::vec3( 2.0f, 0.3f, 2.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 3 ] = glm::vec3( 1.0, 0.3, -4.0 );
|
_DEBUG_otherAvatarListPosition[ 3 ] = glm::vec3( 1.0f, 0.3f, -4.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 4 ] = glm::vec3( -2.0, 0.3, -2.0 );
|
_DEBUG_otherAvatarListPosition[ 4 ] = glm::vec3( -2.0f, 0.3f, -2.0f );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
if ( _bone[b].parent != AVATAR_BONE_NULL ) {
|
||||||
_bone[ _bone[b].parent ].springyVelocity += springDirection * force;
|
_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,23 +1249,27 @@ 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++) {
|
||||||
|
if ( _bone[b].parent != AVATAR_BONE_NULL ) {
|
||||||
glBegin( GL_LINE_STRIP );
|
glBegin( GL_LINE_STRIP );
|
||||||
glVertex3fv( &_bone[ _bone[ b ].parent ].springyPosition.x );
|
glVertex3fv( &_bone[ _bone[ b ].parent ].springyPosition.x );
|
||||||
glVertex3fv( &_bone[ b ].springyPosition.x );
|
glVertex3fv( &_bone[ b ].springyPosition.x );
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
glColor3fv( skinColor );
|
glColor3fv( skinColor );
|
||||||
glLineWidth(3.0);
|
glLineWidth(3.0);
|
||||||
|
|
||||||
for (int b=1; b<NUM_AVATAR_BONES; b++) {
|
for (int b=1; b<NUM_AVATAR_BONES; b++) {
|
||||||
|
if ( _bone[b].parent != AVATAR_BONE_NULL ) {
|
||||||
glBegin( GL_LINE_STRIP );
|
glBegin( GL_LINE_STRIP );
|
||||||
glVertex3fv( &_bone[ _bone[ b ].parent ].position.x );
|
glVertex3fv( &_bone[ _bone[ b ].parent ].position.x );
|
||||||
glVertex3fv( &_bone[ b ].position.x);
|
glVertex3fv( &_bone[ b ].position.x);
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (( _usingSprings ) && ( _triggeringAction )) {
|
if (( _usingSprings ) && ( _triggeringAction )) {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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() {
|
||||||
|
|
Loading…
Reference in a new issue