mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:00:41 +02:00
fixed avatar hand position by making avatars simulate all the time,and also fixing logic of _isMine
This commit is contained in:
parent
7b60ddf057
commit
b7d6ce9747
3 changed files with 87 additions and 77 deletions
|
@ -57,13 +57,14 @@ Head::Head(bool isMine) {
|
||||||
_bodyPitch = 0.0;
|
_bodyPitch = 0.0;
|
||||||
_bodyRoll = 0.0;
|
_bodyRoll = 0.0;
|
||||||
_bodyYawDelta = 0.0;
|
_bodyYawDelta = 0.0;
|
||||||
_triggeringAction = false;
|
_mousePressed = false;
|
||||||
_mode = AVATAR_MODE_STANDING;
|
_mode = AVATAR_MODE_STANDING;
|
||||||
_isMine = isMine;
|
_isMine = isMine;
|
||||||
_maxArmLength = 0.0;
|
_maxArmLength = 0.0;
|
||||||
//_transmitterTimer = 0;
|
//_transmitterTimer = 0;
|
||||||
_transmitterHz = 0.0;
|
_transmitterHz = 0.0;
|
||||||
_transmitterPackets = 0;
|
_transmitterPackets = 0;
|
||||||
|
_numOtherAvatarsInView = 0;
|
||||||
|
|
||||||
initializeSkeleton();
|
initializeSkeleton();
|
||||||
|
|
||||||
|
@ -114,7 +115,8 @@ Head::Head(bool isMine) {
|
||||||
_head.noise = 0;
|
_head.noise = 0;
|
||||||
|
|
||||||
_movedHandOffset = glm::vec3( 0.0, 0.0, 0.0 );
|
_movedHandOffset = glm::vec3( 0.0, 0.0, 0.0 );
|
||||||
_usingBodySprings = false;
|
_usingBodySprings = true;
|
||||||
|
//_usingBodySprings = false;
|
||||||
_springForce = 6.0f;
|
_springForce = 6.0f;
|
||||||
_springVelocityDecay = 16.0f;
|
_springVelocityDecay = 16.0f;
|
||||||
_renderYaw = 0.0;
|
_renderYaw = 0.0;
|
||||||
|
@ -133,11 +135,11 @@ Head::Head(bool isMine) {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// test... just slam them into random positions...
|
// test... just slam them into random positions...
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
_DEBUG_otherAvatarListPosition[ 0 ] = glm::vec3( 0.0f, 0.3f, 2.0f );
|
_otherAvatarHandPosition[ 0 ] = glm::vec3( 0.0f, 0.3f, 2.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 1 ] = glm::vec3( 4.0f, 0.3f, 2.0f );
|
_otherAvatarHandPosition[ 1 ] = glm::vec3( 4.0f, 0.3f, 2.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 2 ] = glm::vec3( 2.0f, 0.3f, 2.0f );
|
_otherAvatarHandPosition[ 2 ] = glm::vec3( 2.0f, 0.3f, 2.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 3 ] = glm::vec3( 1.0f, 0.3f, -4.0f );
|
_otherAvatarHandPosition[ 3 ] = glm::vec3( 1.0f, 0.3f, -4.0f );
|
||||||
_DEBUG_otherAvatarListPosition[ 4 ] = glm::vec3( -2.0f, 0.3f, -2.0f );
|
_otherAvatarHandPosition[ 4 ] = glm::vec3( -2.0f, 0.3f, -2.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
Head::Head(const Head &otherAvatar) {
|
Head::Head(const Head &otherAvatar) {
|
||||||
|
@ -150,7 +152,7 @@ Head::Head(const Head &otherAvatar) {
|
||||||
_bodyPitch = otherAvatar._bodyPitch;
|
_bodyPitch = otherAvatar._bodyPitch;
|
||||||
_bodyRoll = otherAvatar._bodyRoll;
|
_bodyRoll = otherAvatar._bodyRoll;
|
||||||
_bodyYawDelta = otherAvatar._bodyYawDelta;
|
_bodyYawDelta = otherAvatar._bodyYawDelta;
|
||||||
_triggeringAction = otherAvatar._triggeringAction;
|
_mousePressed = otherAvatar._mousePressed;
|
||||||
_mode = otherAvatar._mode;
|
_mode = otherAvatar._mode;
|
||||||
_isMine = otherAvatar._isMine;
|
_isMine = otherAvatar._isMine;
|
||||||
_renderYaw = otherAvatar._renderYaw;
|
_renderYaw = otherAvatar._renderYaw;
|
||||||
|
@ -305,8 +307,8 @@ void Head::setLeanSideways(float dist){
|
||||||
_head.leanSideways = dist;
|
_head.leanSideways = dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::setTriggeringAction( bool d ) {
|
void Head::setMousePressed( bool d ) {
|
||||||
_triggeringAction = d;
|
_mousePressed = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,21 +327,38 @@ void Head::simulate(float deltaTime) {
|
||||||
_closestOtherAvatar = -1;
|
_closestOtherAvatar = -1;
|
||||||
float closestDistance = 10000.0f;
|
float closestDistance = 10000.0f;
|
||||||
|
|
||||||
/*
|
|
||||||
AgentList * agentList = AgentList::getInstance();
|
AgentList * agentList = AgentList::getInstance();
|
||||||
|
|
||||||
|
_numOtherAvatarsInView =0;
|
||||||
|
|
||||||
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin();
|
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin();
|
||||||
agent != agentList->getAgents().end();
|
agent != agentList->getAgents().end();
|
||||||
agent++) {
|
agent++) {
|
||||||
if (( agent->getLinkedData() != NULL && ( agent->getType() == AGENT_TYPE_INTERFACE ) )) {
|
if (( agent->getLinkedData() != NULL && ( agent->getType() == AGENT_TYPE_INTERFACE ) )) {
|
||||||
Head *otherAvatar = (Head *)agent->getLinkedData();
|
Head *otherAvatar = (Head *)agent->getLinkedData();
|
||||||
|
|
||||||
// when this is working, I will grab the position here...
|
if ( _numOtherAvatarsInView < MAX_OTHER_AVATARS ) {
|
||||||
//glm::vec3 otherAvatarPosition = otherAvatar->getBodyPosition();
|
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
// test other avatar hand position for proximity...
|
||||||
|
//-----------------------------------------------------------
|
||||||
|
_otherAvatarHandPosition[ _numOtherAvatarsInView ] = otherAvatar->getBonePosition( AVATAR_BONE_RIGHT_HAND );
|
||||||
|
glm::vec3 v( _bone[ AVATAR_BONE_RIGHT_SHOULDER ].position );
|
||||||
|
v -= _otherAvatarHandPosition[ _numOtherAvatarsInView ];
|
||||||
|
|
||||||
|
float distance = glm::length( v );
|
||||||
|
if ( distance < _maxArmLength ) {
|
||||||
|
if ( distance < closestDistance ) {
|
||||||
|
closestDistance = distance;
|
||||||
|
_closestOtherAvatar = _numOtherAvatarsInView;
|
||||||
|
_numOtherAvatarsInView++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
/*
|
||||||
///for testing only (prior to having real avs working)
|
///for testing only (prior to having real avs working)
|
||||||
for (int o=0; o<NUM_OTHER_AVATARS; o++) {
|
for (int o=0; o<NUM_OTHER_AVATARS; o++) {
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
|
@ -357,16 +376,17 @@ void Head::simulate(float deltaTime) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ( usingBigSphereCollisionTest ) {
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
// test for avatar collision response (using a big sphere :)
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
updateBigSphereCollisionTest(deltaTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//if ( _isMine )
|
}//if ( _isMine )
|
||||||
|
|
||||||
|
if ( usingBigSphereCollisionTest ) {
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
// test for avatar collision response (using a big sphere :)
|
||||||
|
//--------------------------------------------------------------
|
||||||
|
updateBigSphereCollisionTest(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------
|
//------------------------
|
||||||
// update avatar skeleton
|
// update avatar skeleton
|
||||||
//------------------------
|
//------------------------
|
||||||
|
@ -592,13 +612,6 @@ void Head::updateBigSphereCollisionTest( float deltaTime ) {
|
||||||
_usingBodySprings = true;
|
_usingBodySprings = true;
|
||||||
initializeBodySprings();
|
initializeBodySprings();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
else {
|
|
||||||
if (_usingSprings) {
|
|
||||||
_usingSprings = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
// add gravity to velocity
|
// add gravity to velocity
|
||||||
|
@ -669,9 +682,9 @@ void Head::render(int faceToFace) {
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
// render other avatars (DEBUG TEST)
|
// render other avatars (DEBUG TEST)
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
for (int o=0; o<NUM_OTHER_AVATARS; o++) {
|
for (int o=0; o<_numOtherAvatarsInView; o++) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef( _DEBUG_otherAvatarListPosition[o].x, _DEBUG_otherAvatarListPosition[o].y, _DEBUG_otherAvatarListPosition[o].z );
|
glTranslatef( _otherAvatarHandPosition[o].x, _otherAvatarHandPosition[o].y, _otherAvatarHandPosition[o].z );
|
||||||
glScalef( 0.03, 0.03, 0.03 );
|
glScalef( 0.03, 0.03, 0.03 );
|
||||||
glutSolidSphere( 1, 10, 10 );
|
glutSolidSphere( 1, 10, 10 );
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
@ -681,10 +694,10 @@ void Head::render(int faceToFace) {
|
||||||
if ( _closestOtherAvatar != -1 ) {
|
if ( _closestOtherAvatar != -1 ) {
|
||||||
|
|
||||||
glm::vec3 v1( _bone[ AVATAR_BONE_RIGHT_HAND ].position );
|
glm::vec3 v1( _bone[ AVATAR_BONE_RIGHT_HAND ].position );
|
||||||
glm::vec3 v2( _DEBUG_otherAvatarListPosition[ _closestOtherAvatar ] );
|
glm::vec3 v2( _otherAvatarHandPosition[ _closestOtherAvatar ] );
|
||||||
|
|
||||||
glLineWidth( 5.0 );
|
glLineWidth( 8.0 );
|
||||||
glColor4f( 0.9f, 0.5f, 0.2f, 0.6 );
|
glColor4f( 0.7f, 0.4f, 0.1f, 0.6 );
|
||||||
glBegin( GL_LINE_STRIP );
|
glBegin( GL_LINE_STRIP );
|
||||||
glVertex3f( v1.x, v1.y, v1.z );
|
glVertex3f( v1.x, v1.y, v1.z );
|
||||||
glVertex3f( v2.x, v2.y, v2.z );
|
glVertex3f( v2.x, v2.y, v2.z );
|
||||||
|
@ -871,7 +884,7 @@ void Head::startHandMovement() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::stopHandMovement() {
|
void Head::stopHandMovement() {
|
||||||
_usingBodySprings = false;
|
//_usingBodySprings = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Head::setHandMovementValues( glm::vec3 handOffset ) {
|
void Head::setHandMovementValues( glm::vec3 handOffset ) {
|
||||||
|
@ -1006,28 +1019,6 @@ void Head::updateSkeleton() {
|
||||||
_orientation.setToIdentity();
|
_orientation.setToIdentity();
|
||||||
_orientation.yaw( _bodyYaw );
|
_orientation.yaw( _bodyYaw );
|
||||||
|
|
||||||
/*
|
|
||||||
glm::quat quaternion
|
|
||||||
(
|
|
||||||
glm::vec3
|
|
||||||
(
|
|
||||||
_bodyPitch * PI_OVER_180,
|
|
||||||
_bodyYaw * PI_OVER_180,
|
|
||||||
_bodyRoll * PI_OVER_180
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
glm::mat4 rotationMatrix = glm::mat4_cast( quaternion );
|
|
||||||
|
|
||||||
glm::vec4 right( 1.0, 0.0, 0.0, 0.0 );
|
|
||||||
glm::vec4 up ( 0.0, 1.0, 0.0, 0.0 );
|
|
||||||
glm::vec4 front( 0.0, 0.0, 1.0, 0.0 );
|
|
||||||
|
|
||||||
rightDirection = glm::vec3( right * rotationMatrix );
|
|
||||||
upDirection = glm::vec3( up * rotationMatrix );
|
|
||||||
frontDirection = glm::vec3( front * rotationMatrix );
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// calculate positions of all bones by traversing the skeleton tree:
|
// calculate positions of all bones by traversing the skeleton tree:
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
|
@ -1086,7 +1077,7 @@ 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 ) {
|
if ( _bone[b].parent != AVATAR_BONE_NULL ) {
|
||||||
_bone[ _bone[b].parent ].springyVelocity += springDirection * force;
|
_bone[ _bone[b].parent ].springyVelocity += springDirection * force;
|
||||||
|
@ -1145,6 +1136,11 @@ glm::vec3 Head::getHeadPosition() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glm::vec3 Head::getBonePosition( AvatarBones b ) {
|
||||||
|
return _bone[b].position;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Head::updateHandMovement() {
|
void Head::updateHandMovement() {
|
||||||
glm::vec3 transformedHandMovement;
|
glm::vec3 transformedHandMovement;
|
||||||
|
@ -1154,13 +1150,12 @@ void Head::updateHandMovement() {
|
||||||
+ _orientation.getUp() * -_movedHandOffset.y * 0.5f
|
+ _orientation.getUp() * -_movedHandOffset.y * 0.5f
|
||||||
+ _orientation.getFront() * -_movedHandOffset.y;
|
+ _orientation.getFront() * -_movedHandOffset.y;
|
||||||
|
|
||||||
|
|
||||||
_bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement;
|
_bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement;
|
||||||
|
|
||||||
//if holding hands, add a pull to the hand...
|
//if holding hands, add a pull to the hand...
|
||||||
if ( _usingBodySprings ) {
|
if ( _usingBodySprings ) {
|
||||||
if ( _closestOtherAvatar != -1 ) {
|
if ( _closestOtherAvatar != -1 ) {
|
||||||
if ( _triggeringAction ) {
|
if ( _mousePressed ) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
glm::vec3 handShakePull( DEBUG_otherAvatarListPosition[ closestOtherAvatar ]);
|
glm::vec3 handShakePull( DEBUG_otherAvatarListPosition[ closestOtherAvatar ]);
|
||||||
|
@ -1171,7 +1166,7 @@ void Head::updateHandMovement() {
|
||||||
transformedHandMovement += handShakePull;
|
transformedHandMovement += handShakePull;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
_bone[ AVATAR_BONE_RIGHT_HAND ].position = _DEBUG_otherAvatarListPosition[ _closestOtherAvatar ];
|
_bone[ AVATAR_BONE_RIGHT_HAND ].position = _otherAvatarHandPosition[ _closestOtherAvatar ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1251,6 +1246,18 @@ void Head::renderBody() {
|
||||||
// Render bone positions as spheres
|
// Render bone positions as spheres
|
||||||
//-----------------------------------------
|
//-----------------------------------------
|
||||||
for (int b=0; b<NUM_AVATAR_BONES; b++) {
|
for (int b=0; b<NUM_AVATAR_BONES; b++) {
|
||||||
|
|
||||||
|
/*
|
||||||
|
if ( _isMine )
|
||||||
|
{
|
||||||
|
printf( "my avatar: %d\n", _usingBodySprings );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "other avatar: %d\n", _usingBodySprings );
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if ( _usingBodySprings ) {
|
if ( _usingBodySprings ) {
|
||||||
glColor3fv( lightBlue );
|
glColor3fv( lightBlue );
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
@ -1298,7 +1305,7 @@ void Head::renderBody() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (( _usingBodySprings ) && ( _triggeringAction )) {
|
if (( _usingBodySprings ) && ( _mousePressed )) {
|
||||||
glColor4f( 1.0, 1.0, 0.5, 0.5 );
|
glColor4f( 1.0, 1.0, 0.5, 0.5 );
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef
|
glTranslatef
|
||||||
|
|
|
@ -34,7 +34,7 @@ enum eyeContactTargets {LEFT_EYE, RIGHT_EYE, MOUTH};
|
||||||
#define ROT_RIGHT 7
|
#define ROT_RIGHT 7
|
||||||
#define MAX_DRIVE_KEYS 8
|
#define MAX_DRIVE_KEYS 8
|
||||||
|
|
||||||
#define NUM_OTHER_AVATARS 5 // temporary - for testing purposes!
|
#define MAX_OTHER_AVATARS 50 // temporary - for testing purposes!
|
||||||
|
|
||||||
enum AvatarMode
|
enum AvatarMode
|
||||||
{
|
{
|
||||||
|
@ -172,7 +172,7 @@ class Head : public AvatarData {
|
||||||
|
|
||||||
AvatarMode getMode();
|
AvatarMode getMode();
|
||||||
|
|
||||||
void setTriggeringAction( bool trigger );
|
void setMousePressed( bool pressed );
|
||||||
|
|
||||||
void render(int faceToFace);
|
void render(int faceToFace);
|
||||||
|
|
||||||
|
@ -214,10 +214,10 @@ class Head : public AvatarData {
|
||||||
bool _isMine;
|
bool _isMine;
|
||||||
glm::vec3 _TEST_bigSpherePosition;
|
glm::vec3 _TEST_bigSpherePosition;
|
||||||
float _TEST_bigSphereRadius;
|
float _TEST_bigSphereRadius;
|
||||||
glm::vec3 _DEBUG_otherAvatarListPosition[ NUM_OTHER_AVATARS ];
|
glm::vec3 _otherAvatarHandPosition[ MAX_OTHER_AVATARS ];
|
||||||
bool _triggeringAction;
|
bool _mousePressed;
|
||||||
float _bodyYawDelta;
|
float _bodyYawDelta;
|
||||||
float _closeEnoughToInteract;
|
//float _closeEnoughToInteract;
|
||||||
int _closestOtherAvatar;
|
int _closestOtherAvatar;
|
||||||
bool _usingBodySprings;
|
bool _usingBodySprings;
|
||||||
glm::vec3 _movedHandOffset;
|
glm::vec3 _movedHandOffset;
|
||||||
|
@ -230,6 +230,7 @@ class Head : public AvatarData {
|
||||||
glm::vec3 _thrust;
|
glm::vec3 _thrust;
|
||||||
float _maxArmLength;
|
float _maxArmLength;
|
||||||
Orientation _orientation;
|
Orientation _orientation;
|
||||||
|
int _numOtherAvatarsInView;
|
||||||
|
|
||||||
int _driveKeys[MAX_DRIVE_KEYS];
|
int _driveKeys[MAX_DRIVE_KEYS];
|
||||||
GLUquadric* _sphere;
|
GLUquadric* _sphere;
|
||||||
|
|
|
@ -208,7 +208,6 @@ void initializeHandController() {
|
||||||
handController.rampUpRate = 0.05;
|
handController.rampUpRate = 0.05;
|
||||||
handController.rampDownRate = 0.02;
|
handController.rampDownRate = 0.02;
|
||||||
handController.envelope = 0.0f;
|
handController.envelope = 0.0f;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateHandController( int x, int y ) {
|
void updateHandController( int x, int y ) {
|
||||||
|
@ -238,7 +237,8 @@ void updateHandController( int x, int y ) {
|
||||||
handController.startX = WIDTH / 2;
|
handController.startX = WIDTH / 2;
|
||||||
handController.startY = HEIGHT / 2;
|
handController.startY = HEIGHT / 2;
|
||||||
handController.envelope = 0.0;
|
handController.envelope = 0.0;
|
||||||
myAvatar.stopHandMovement();
|
//prototype
|
||||||
|
//myAvatar.stopHandMovement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -918,6 +918,9 @@ void display(void)
|
||||||
if (agent->getLinkedData() != NULL) {
|
if (agent->getLinkedData() != NULL) {
|
||||||
Head *avatar = (Head *)agent->getLinkedData();
|
Head *avatar = (Head *)agent->getLinkedData();
|
||||||
//glPushMatrix();
|
//glPushMatrix();
|
||||||
|
|
||||||
|
//printf( "rendering remote avatar\n" );
|
||||||
|
|
||||||
avatar->render(0);
|
avatar->render(0);
|
||||||
//glPopMatrix();
|
//glPopMatrix();
|
||||||
}
|
}
|
||||||
|
@ -1390,7 +1393,6 @@ void key(unsigned char k, int x, int y)
|
||||||
{
|
{
|
||||||
myAvatar.setNoise(0);
|
myAvatar.setNoise(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k == 'h') {
|
if (k == 'h') {
|
||||||
|
@ -1467,13 +1469,12 @@ void idle(void) {
|
||||||
// update behaviors for avatar hand movement
|
// update behaviors for avatar hand movement
|
||||||
updateHandController( mouseX, mouseY );
|
updateHandController( mouseX, mouseY );
|
||||||
|
|
||||||
// when the mouse is being pressed, an 'action' is being
|
// tell my avatar if the mouse is being pressed...
|
||||||
// triggered in the avatar. The action is context-based.
|
|
||||||
if ( mousePressed == 1 ) {
|
if ( mousePressed == 1 ) {
|
||||||
myAvatar.setTriggeringAction( true );
|
myAvatar.setMousePressed( true );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myAvatar.setTriggeringAction( false );
|
myAvatar.setMousePressed( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
// walking triggers the handController to stop
|
// walking triggers the handController to stop
|
||||||
|
@ -1486,7 +1487,6 @@ void idle(void) {
|
||||||
//
|
//
|
||||||
updateAvatar( 1.f/FPS );
|
updateAvatar( 1.f/FPS );
|
||||||
|
|
||||||
|
|
||||||
//loop through all the other avatars and simulate them.
|
//loop through all the other avatars and simulate them.
|
||||||
AgentList * agentList = AgentList::getInstance();
|
AgentList * agentList = AgentList::getInstance();
|
||||||
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin(); agent != agentList->getAgents().end(); agent++)
|
for(std::vector<Agent>::iterator agent = agentList->getAgents().begin(); agent != agentList->getAgents().end(); agent++)
|
||||||
|
@ -1494,11 +1494,13 @@ void idle(void) {
|
||||||
if (agent->getLinkedData() != NULL)
|
if (agent->getLinkedData() != NULL)
|
||||||
{
|
{
|
||||||
Head *avatar = (Head *)agent->getLinkedData();
|
Head *avatar = (Head *)agent->getLinkedData();
|
||||||
|
|
||||||
|
//printf( "simulating remote avatar\n" );
|
||||||
|
|
||||||
avatar->simulate(deltaTime);
|
avatar->simulate(deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//updateAvatarHand(1.f/FPS);
|
//updateAvatarHand(1.f/FPS);
|
||||||
|
|
||||||
field.simulate (deltaTime);
|
field.simulate (deltaTime);
|
||||||
|
|
Loading…
Reference in a new issue