mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
Merge pull request #220 from Ventrella/master
lots of changes to improve avatar touch
This commit is contained in:
commit
33d58b45f3
8 changed files with 311 additions and 271 deletions
|
@ -34,10 +34,6 @@ const float BODY_ROLL_WHILE_TURNING = 0.1;
|
|||
const float LIN_VEL_DECAY = 5.0;
|
||||
const float MY_HAND_HOLDING_PULL = 0.2;
|
||||
const float YOUR_HAND_HOLDING_PULL = 1.0;
|
||||
|
||||
//const float BODY_SPRING_DEFAULT_TIGHTNESS = 20.0f;
|
||||
//const float BODY_SPRING_FORCE = 6.0f;
|
||||
|
||||
const float BODY_SPRING_DEFAULT_TIGHTNESS = 1500.0f;
|
||||
const float BODY_SPRING_FORCE = 300.0f;
|
||||
|
||||
|
@ -144,13 +140,14 @@ Avatar::Avatar(bool isMine) {
|
|||
_renderYaw = 0.0;
|
||||
_renderPitch = 0.0;
|
||||
_sphere = NULL;
|
||||
_interactingOther = NULL;
|
||||
_handHoldingPosition = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
_distanceToNearestAvatar = std::numeric_limits<float>::max();
|
||||
_gravity = glm::vec3(0.0f, -1.0f, 0.0f); // default
|
||||
|
||||
initializeSkeleton();
|
||||
|
||||
_avatarTouch.setReachableRadius(0.6);
|
||||
|
||||
if (iris_texture.size() == 0) {
|
||||
switchToResourcesParentIfRequired();
|
||||
unsigned error = lodepng::decode(iris_texture, iris_texture_width, iris_texture_height, iris_texture_file);
|
||||
|
@ -295,7 +292,6 @@ void Avatar::UpdateGyros(float frametime, SerialInterface* serialInterface, glm:
|
|||
if ((_headYaw < MAX_YAW) && (_headYaw > MIN_YAW)) {
|
||||
addHeadYaw(_head.yawRate * HEAD_ROTATION_SCALE * frametime);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float Avatar::getAbsoluteHeadYaw() const {
|
||||
|
@ -316,16 +312,14 @@ void Avatar::setLeanSideways(float dist){
|
|||
_head.leanSideways = dist;
|
||||
}
|
||||
|
||||
void Avatar::setMousePressed(bool d) {
|
||||
_mousePressed = d;
|
||||
void Avatar::setMousePressed(bool mousePressed) {
|
||||
_mousePressed = mousePressed;
|
||||
}
|
||||
|
||||
|
||||
bool Avatar::getIsNearInteractingOther() {
|
||||
return _avatarTouch.getAbleToReachOtherAvatar();
|
||||
}
|
||||
|
||||
|
||||
void Avatar::simulate(float deltaTime) {
|
||||
|
||||
|
||||
|
@ -335,9 +329,15 @@ void Avatar::simulate(float deltaTime) {
|
|||
// update avatar skeleton
|
||||
updateSkeleton();
|
||||
|
||||
//detect and respond to collisions with other avatars...
|
||||
if (_isMine) {
|
||||
updateAvatarCollisions(deltaTime);
|
||||
}
|
||||
|
||||
//update the movement of the hand and process handshaking with other avatars...
|
||||
updateHandMovementAndTouching(deltaTime);
|
||||
|
||||
|
||||
_avatarTouch.simulate(deltaTime);
|
||||
|
||||
// apply gravity and collision with the ground/floor
|
||||
if (USING_AVATAR_GRAVITY) {
|
||||
|
@ -381,7 +381,7 @@ void Avatar::simulate(float deltaTime) {
|
|||
|
||||
// decay body rotation momentum
|
||||
float bodySpinMomentum = 1.0 - BODY_SPIN_FRICTION * deltaTime;
|
||||
if ( bodySpinMomentum < 0.0f ) { bodySpinMomentum = 0.0f; }
|
||||
if (bodySpinMomentum < 0.0f) { bodySpinMomentum = 0.0f; }
|
||||
_bodyPitchDelta *= bodySpinMomentum;
|
||||
_bodyYawDelta *= bodySpinMomentum;
|
||||
_bodyRollDelta *= bodySpinMomentum;
|
||||
|
@ -430,8 +430,6 @@ void Avatar::simulate(float deltaTime) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
//update the movement of the hand and process handshaking with other avatars...
|
||||
void Avatar::updateHandMovementAndTouching(float deltaTime) {
|
||||
|
||||
// reset hand and arm positions according to hand movement
|
||||
|
@ -441,104 +439,60 @@ void Avatar::updateHandMovementAndTouching(float deltaTime) {
|
|||
+ _orientation.getFront() * -_movedHandOffset.y * 1.0f;
|
||||
|
||||
_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position += transformedHandMovement;
|
||||
|
||||
if (_isMine) {
|
||||
_handState = _mousePressed;
|
||||
}
|
||||
|
||||
//reset these for the next go-round
|
||||
_avatarTouch.setAbleToReachOtherAvatar (false);
|
||||
_avatarTouch.setHandsCloseEnoughToGrasp(false);
|
||||
|
||||
// if the avatar being simulated is mine, then loop through
|
||||
// all the other avatars for potential interactions...
|
||||
|
||||
if (_isMine)
|
||||
{
|
||||
// Reset detector for nearest avatar
|
||||
_distanceToNearestAvatar = std::numeric_limits<float>::max();
|
||||
_avatarTouch.setMyBodyPosition(_position);
|
||||
|
||||
Avatar * _interactingOther = NULL;
|
||||
float closestDistance = std::numeric_limits<float>::max();
|
||||
|
||||
//loop through all the other avatars for potential interactions...
|
||||
AgentList* agentList = AgentList::getInstance();
|
||||
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
|
||||
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
|
||||
Avatar *otherAvatar = (Avatar *)agent->getLinkedData();
|
||||
|
||||
// check for collisions with other avatars and respond
|
||||
updateCollisionWithOtherAvatar(otherAvatar, deltaTime );
|
||||
|
||||
// test other avatar hand position for proximity
|
||||
glm::vec3 v(_joint[ AVATAR_JOINT_RIGHT_SHOULDER ].position);
|
||||
v -= otherAvatar->getJointPosition(AVATAR_JOINT_RIGHT_SHOULDER);
|
||||
|
||||
// test whether shoulders are close enough to allow for reaching to touch hands
|
||||
glm::vec3 v(_position - otherAvatar->_position);
|
||||
float distance = glm::length(v);
|
||||
if (distance < _distanceToNearestAvatar) {_distanceToNearestAvatar = distance;}
|
||||
|
||||
if (distance < _maxArmLength + _maxArmLength) {
|
||||
|
||||
if (distance < closestDistance) {
|
||||
closestDistance = distance;
|
||||
_interactingOther = otherAvatar;
|
||||
|
||||
if (! _avatarTouch.getAbleToReachOtherAvatar()) {
|
||||
//initialize _handHolding
|
||||
_handHoldingPosition = _joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position;
|
||||
_avatarTouch.setAbleToReachOtherAvatar(true);
|
||||
}
|
||||
|
||||
glm::vec3 vectorBetweenHands(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
|
||||
vectorBetweenHands -= otherAvatar->getJointPosition(AVATAR_JOINT_RIGHT_FINGERTIPS);
|
||||
float distanceBetweenHands = glm::length(vectorBetweenHands);
|
||||
|
||||
if (distanceBetweenHands < HANDS_CLOSE_ENOUGH_TO_GRASP) {
|
||||
_avatarTouch.setHandsCloseEnoughToGrasp(true);
|
||||
}
|
||||
|
||||
// if I am holding hands with another avatar, a force is applied
|
||||
if ((_handState == 1) || (_interactingOther->_handState == 1)) {
|
||||
|
||||
// if the hands are close enough to grasp...
|
||||
if (distanceBetweenHands < HANDS_CLOSE_ENOUGH_TO_GRASP)
|
||||
{
|
||||
// apply the forces...
|
||||
glm::vec3 vectorToOtherHand = _interactingOther->_handPosition - _handHoldingPosition;
|
||||
glm::vec3 vectorToMyHand = _joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position - _handHoldingPosition;
|
||||
|
||||
_handHoldingPosition += vectorToOtherHand * YOUR_HAND_HOLDING_PULL;
|
||||
_handHoldingPosition += vectorToMyHand * MY_HAND_HOLDING_PULL;
|
||||
_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position = _handHoldingPosition;
|
||||
|
||||
// apply a force to the avatar body
|
||||
if (glm::length(vectorToOtherHand) > _maxArmLength * 0.9) {
|
||||
_velocity += vectorToOtherHand;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the vector we send for hand position to other people to be our right hand
|
||||
setHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
|
||||
|
||||
if (_interactingOther) {
|
||||
_avatarTouch.setYourBodyPosition(_interactingOther->_position);
|
||||
_avatarTouch.setYourHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].springyPosition);
|
||||
_avatarTouch.setYourHandState (_interactingOther->_handState);
|
||||
}
|
||||
|
||||
}//if (_isMine)
|
||||
|
||||
//constrain right arm length and re-adjust elbow position as it bends
|
||||
// NOTE - the following must be called on all avatars - not just _isMine
|
||||
updateArmIKAndConstraints(deltaTime);
|
||||
|
||||
// set hand positions for _avatarTouch.setMyHandPosition AFTER calling updateArmIKAndConstraints
|
||||
if (_interactingOther) {
|
||||
if (_isMine) {
|
||||
_avatarTouch.setMyHandPosition (_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
|
||||
_avatarTouch.setYourHandPosition(_interactingOther->_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
|
||||
_avatarTouch.setMyHandState (_handState);
|
||||
_avatarTouch.setYourHandState (_interactingOther->_handState);
|
||||
_avatarTouch.simulate(deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
if (!_avatarTouch.getAbleToReachOtherAvatar() ) {
|
||||
_interactingOther = NULL;
|
||||
if (_isMine) {
|
||||
//Set the vector we send for hand position to other people to be our right hand
|
||||
setHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].position);
|
||||
|
||||
if (_mousePressed) {
|
||||
_handState = 1;
|
||||
} else {
|
||||
_handState = 0;
|
||||
}
|
||||
|
||||
_avatarTouch.setMyHandState(_handState);
|
||||
|
||||
if (_handState == 1) {
|
||||
_avatarTouch.setMyHandPosition(_joint[ AVATAR_JOINT_RIGHT_FINGERTIPS ].springyPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Avatar::updateHead(float deltaTime) {
|
||||
|
||||
//apply the head lean values to the springy position...
|
||||
|
@ -690,66 +644,96 @@ void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float d
|
|||
}
|
||||
|
||||
|
||||
//detect collisions with other avatars and respond
|
||||
void Avatar::updateCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) {
|
||||
|
||||
// check if the bounding spheres of the two avatars are colliding
|
||||
glm::vec3 vectorBetweenBoundingSpheres(_position - otherAvatar->_position);
|
||||
if (glm::length(vectorBetweenBoundingSpheres) < _height * ONE_HALF + otherAvatar->_height * ONE_HALF) {
|
||||
|
||||
void Avatar::updateAvatarCollisions(float deltaTime) {
|
||||
|
||||
// Reset detector for nearest avatar
|
||||
_distanceToNearestAvatar = std::numeric_limits<float>::max();
|
||||
|
||||
//loop through all the other avatars for potential interactions...
|
||||
AgentList* agentList = AgentList::getInstance();
|
||||
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
|
||||
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
|
||||
Avatar *otherAvatar = (Avatar *)agent->getLinkedData();
|
||||
|
||||
// check if the bounding spheres of the two avatars are colliding
|
||||
glm::vec3 vectorBetweenBoundingSpheres(_position - otherAvatar->_position);
|
||||
if (glm::length(vectorBetweenBoundingSpheres) < _height * ONE_HALF + otherAvatar->_height * ONE_HALF) {
|
||||
//apply forces from collision
|
||||
applyCollisionWithOtherAvatar(otherAvatar, deltaTime );
|
||||
}
|
||||
|
||||
// test other avatar hand position for proximity
|
||||
glm::vec3 v(_joint[ AVATAR_JOINT_RIGHT_SHOULDER ].position);
|
||||
v -= otherAvatar->getPosition();
|
||||
|
||||
float distance = glm::length(v);
|
||||
if (distance < _distanceToNearestAvatar) {
|
||||
_distanceToNearestAvatar = distance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//detect collisions with other avatars and respond
|
||||
void Avatar::applyCollisionWithOtherAvatar(Avatar * otherAvatar, float deltaTime) {
|
||||
|
||||
float bodyMomentum = 1.0f;
|
||||
glm::vec3 bodyPushForce = glm::vec3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
// loop through the joints of each avatar to check for every possible collision
|
||||
for (int b=1; b<NUM_AVATAR_JOINTS; b++) {
|
||||
if (_joint[b].isCollidable) {
|
||||
// loop through the joints of each avatar to check for every possible collision
|
||||
for (int b=1; b<NUM_AVATAR_JOINTS; b++) {
|
||||
if (_joint[b].isCollidable) {
|
||||
|
||||
for (int o=b+1; o<NUM_AVATAR_JOINTS; o++) {
|
||||
if (otherAvatar->_joint[o].isCollidable) {
|
||||
for (int o=b+1; o<NUM_AVATAR_JOINTS; o++) {
|
||||
if (otherAvatar->_joint[o].isCollidable) {
|
||||
|
||||
glm::vec3 vectorBetweenJoints(_joint[b].springyPosition - otherAvatar->_joint[o].springyPosition);
|
||||
float distanceBetweenJoints = glm::length(vectorBetweenJoints);
|
||||
|
||||
glm::vec3 vectorBetweenJoints(_joint[b].springyPosition - otherAvatar->_joint[o].springyPosition);
|
||||
float distanceBetweenJoints = glm::length(vectorBetweenJoints);
|
||||
|
||||
if (distanceBetweenJoints > 0.0 ) { // to avoid divide by zero
|
||||
float combinedRadius = _joint[b].radius + otherAvatar->_joint[o].radius;
|
||||
if (distanceBetweenJoints > 0.0 ) { // to avoid divide by zero
|
||||
float combinedRadius = _joint[b].radius + otherAvatar->_joint[o].radius;
|
||||
|
||||
// check for collision
|
||||
if (distanceBetweenJoints < combinedRadius * COLLISION_RADIUS_SCALAR) {
|
||||
glm::vec3 directionVector = vectorBetweenJoints / distanceBetweenJoints;
|
||||
// check for collision
|
||||
if (distanceBetweenJoints < combinedRadius * COLLISION_RADIUS_SCALAR) {
|
||||
glm::vec3 directionVector = vectorBetweenJoints / distanceBetweenJoints;
|
||||
|
||||
// push balls away from each other and apply friction
|
||||
glm::vec3 ballPushForce = directionVector * COLLISION_BALL_FORCE * deltaTime;
|
||||
|
||||
float ballMomentum = 1.0 - COLLISION_BALL_FRICTION * deltaTime;
|
||||
if (ballMomentum < 0.0 ) { ballMomentum = 0.0;}
|
||||
|
||||
_joint[b].springyVelocity += ballPushForce;
|
||||
otherAvatar->_joint[o].springyVelocity -= ballPushForce;
|
||||
|
||||
_joint[b].springyVelocity *= ballMomentum;
|
||||
otherAvatar->_joint[o].springyVelocity *= ballMomentum;
|
||||
|
||||
// accumulate forces and frictions to apply to the velocities of avatar bodies
|
||||
bodyPushForce += directionVector * COLLISION_BODY_FORCE * deltaTime;
|
||||
bodyMomentum -= COLLISION_BODY_FRICTION * deltaTime;
|
||||
if (bodyMomentum < 0.0 ) { bodyMomentum = 0.0;}
|
||||
|
||||
}// check for collision
|
||||
} // to avoid divide by zero
|
||||
} // o loop
|
||||
} // collidable
|
||||
} // b loop
|
||||
} // collidable
|
||||
|
||||
|
||||
//apply forces and frictions on the bodies of both avatars
|
||||
_velocity += bodyPushForce;
|
||||
otherAvatar->_velocity -= bodyPushForce;
|
||||
_velocity *= bodyMomentum;
|
||||
otherAvatar->_velocity *= bodyMomentum;
|
||||
}
|
||||
|
||||
// push balls away from each other and apply friction
|
||||
glm::vec3 ballPushForce = directionVector * COLLISION_BALL_FORCE * deltaTime;
|
||||
|
||||
float ballMomentum = 1.0 - COLLISION_BALL_FRICTION * deltaTime;
|
||||
if (ballMomentum < 0.0 ) { ballMomentum = 0.0;}
|
||||
|
||||
_joint[b].springyVelocity += ballPushForce;
|
||||
otherAvatar->_joint[o].springyVelocity -= ballPushForce;
|
||||
|
||||
_joint[b].springyVelocity *= ballMomentum;
|
||||
otherAvatar->_joint[o].springyVelocity *= ballMomentum;
|
||||
|
||||
// accumulate forces and frictions to apply to the velocities of avatar bodies
|
||||
bodyPushForce += directionVector * COLLISION_BODY_FORCE * deltaTime;
|
||||
bodyMomentum -= COLLISION_BODY_FRICTION * deltaTime;
|
||||
if (bodyMomentum < 0.0 ) { bodyMomentum = 0.0;}
|
||||
|
||||
}// check for collision
|
||||
} // to avoid divide by zero
|
||||
} // o loop
|
||||
} // collidable
|
||||
} // b loop
|
||||
} // collidable
|
||||
|
||||
|
||||
//apply forces and frictions on the bodies of both avatars
|
||||
_velocity += bodyPushForce;
|
||||
otherAvatar->_velocity -= bodyPushForce;
|
||||
_velocity *= bodyMomentum;
|
||||
otherAvatar->_velocity *= bodyMomentum;
|
||||
|
||||
} // bounding sphere collision
|
||||
} //method
|
||||
|
||||
|
||||
void Avatar::setDisplayingHead(bool displayingHead ) {
|
||||
|
@ -768,7 +752,7 @@ void Avatar::setGravity(glm::vec3 gravity) {
|
|||
}
|
||||
|
||||
|
||||
void Avatar::render(bool lookingInMirror) {
|
||||
void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
|
||||
|
||||
// render a simple round on the ground projected down from the avatar's position
|
||||
renderDiskShadow(_position, glm::vec3(0.0f, 1.0f, 0.0f ), 0.1f, 0.2f );
|
||||
|
@ -803,7 +787,7 @@ void Avatar::render(bool lookingInMirror) {
|
|||
|
||||
// if this is my avatar, then render my interactions with the other avatar
|
||||
if (_isMine ) {
|
||||
_avatarTouch.render();
|
||||
_avatarTouch.render(cameraPosition);
|
||||
}
|
||||
|
||||
// Render the balls
|
||||
|
@ -1193,6 +1177,9 @@ void Avatar::initializeSkeleton() {
|
|||
|
||||
// generate world positions
|
||||
updateSkeleton();
|
||||
|
||||
//set spring positions to be in the skeleton bone positions
|
||||
initializeBodySprings();
|
||||
}
|
||||
|
||||
void Avatar::calculateBoneLengths() {
|
||||
|
|
|
@ -101,13 +101,6 @@ public:
|
|||
void setLeanForward(float dist);
|
||||
void setLeanSideways(float dist);
|
||||
void addLean(float x, float z);
|
||||
|
||||
/*
|
||||
const glm::vec3& getHeadRightDirection() const { return _orientation.getRight(); };
|
||||
const glm::vec3& getHeadUpDirection () const { return _orientation.getUp (); };
|
||||
const glm::vec3& getHeadFrontDirection() const { return _orientation.getFront(); };
|
||||
*/
|
||||
|
||||
const glm::vec3& getHeadPosition() const ;
|
||||
const glm::vec3& getJointPosition(AvatarJointID j) const { return _joint[j].position; };
|
||||
const glm::vec3& getBodyUpDirection() const { return _orientation.getUp(); };
|
||||
|
@ -117,8 +110,8 @@ public:
|
|||
|
||||
AvatarMode getMode();
|
||||
|
||||
void setMousePressed( bool pressed );
|
||||
void render(bool lookingInMirror);
|
||||
void setMousePressed(bool pressed);
|
||||
void render(bool lookingInMirrorm, glm::vec3 cameraPosition);
|
||||
void renderBody();
|
||||
void renderHead(bool lookingInMirror);
|
||||
void simulate(float);
|
||||
|
@ -241,7 +234,6 @@ private:
|
|||
float _transmitterHz;
|
||||
int _transmitterPackets;
|
||||
glm::vec3 _transmitterInitialReading;
|
||||
Avatar* _interactingOther;
|
||||
float _pelvisStandingHeight;
|
||||
float _height;
|
||||
Balls* _balls;
|
||||
|
@ -260,8 +252,9 @@ private:
|
|||
void readSensors();
|
||||
void updateHead( float deltaTime );
|
||||
void updateHandMovementAndTouching(float deltaTime);
|
||||
void updateAvatarCollisions(float deltaTime);
|
||||
void updateCollisionWithSphere( glm::vec3 position, float radius, float deltaTime );
|
||||
void updateCollisionWithOtherAvatar( Avatar * other, float deltaTime );
|
||||
void applyCollisionWithOtherAvatar( Avatar * other, float deltaTime );
|
||||
void setHeadFromGyros(glm::vec3 * eulerAngles, glm::vec3 * angularVelocity, float deltaTime, float smoothingTime);
|
||||
void setHeadSpringScale(float s) { _head.returnSpringScale = s; }
|
||||
};
|
||||
|
|
|
@ -16,13 +16,4 @@ AvatarRenderer::AvatarRenderer() {
|
|||
|
||||
// this method renders the avatar
|
||||
void AvatarRenderer::render(Avatar *avatar, bool lookingInMirror) {
|
||||
/*
|
||||
// show avatar position
|
||||
glColor4f( 0.5f, 0.5f, 0.5f, 0.6 );
|
||||
glPushMatrix();
|
||||
glTranslatef(avatar->_position.x, avatar->_position.y, avatar->_position.z);
|
||||
glScalef( 0.03, 0.03, 0.03 );
|
||||
glutSolidSphere( 1, 10, 10 );
|
||||
glPopMatrix();
|
||||
*/
|
||||
}
|
|
@ -10,6 +10,7 @@
|
|||
#include <SharedUtil.h>
|
||||
#include "AvatarTouch.h"
|
||||
#include "InterfaceConfig.h"
|
||||
#include "Util.h"
|
||||
|
||||
const float THREAD_RADIUS = 0.012;
|
||||
|
||||
|
@ -17,8 +18,11 @@ AvatarTouch::AvatarTouch() {
|
|||
|
||||
_myHandPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
|
||||
_yourHandPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
|
||||
_myBodyPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
|
||||
_yourBodyPosition = glm::vec3( 0.0f, 0.0f, 0.0f );
|
||||
_myHandState = 0;
|
||||
_yourHandState = 0;
|
||||
_yourHandState = 0;
|
||||
_reachableRadius = 0.0f;
|
||||
|
||||
_canReachToOtherAvatar = false;
|
||||
_handsCloseEnoughToGrasp = false;
|
||||
|
@ -28,40 +32,46 @@ AvatarTouch::AvatarTouch() {
|
|||
}
|
||||
}
|
||||
|
||||
void AvatarTouch::setMyHandPosition( glm::vec3 position ) {
|
||||
void AvatarTouch::setMyHandPosition(glm::vec3 position) {
|
||||
_myHandPosition = position;
|
||||
}
|
||||
|
||||
void AvatarTouch::setYourHandPosition( glm::vec3 position ) {
|
||||
void AvatarTouch::setYourHandPosition(glm::vec3 position) {
|
||||
_yourHandPosition = position;
|
||||
}
|
||||
|
||||
void AvatarTouch::setMyHandState( int state ) {
|
||||
void AvatarTouch::setMyBodyPosition(glm::vec3 position) {
|
||||
_myBodyPosition = position;
|
||||
}
|
||||
|
||||
void AvatarTouch::setYourBodyPosition(glm::vec3 position) {
|
||||
_yourBodyPosition = position;
|
||||
}
|
||||
|
||||
void AvatarTouch::setMyHandState(int state) {
|
||||
_myHandState = state;
|
||||
}
|
||||
|
||||
void AvatarTouch::setYourHandState( int state ) {
|
||||
void AvatarTouch::setYourHandState(int state) {
|
||||
_yourHandState = state;
|
||||
}
|
||||
|
||||
void AvatarTouch::render() {
|
||||
void AvatarTouch::setReachableRadius(float r) {
|
||||
_reachableRadius = r;
|
||||
}
|
||||
|
||||
glm::vec3 v1( _myHandPosition );
|
||||
glm::vec3 v2( _yourHandPosition );
|
||||
|
||||
void AvatarTouch::render(glm::vec3 cameraPosition) {
|
||||
|
||||
if (_canReachToOtherAvatar) {
|
||||
// if my hand is grasping, show it...
|
||||
if ( _myHandState == 1 ) {
|
||||
glPushMatrix();
|
||||
glTranslatef(_myHandPosition.x, _myHandPosition.y, _myHandPosition.z);
|
||||
glColor4f( 1.0, 1.0, 0.8, 0.3 ); glutSolidSphere( 0.020f, 10.0f, 10.0f );
|
||||
glColor4f( 1.0, 1.0, 0.4, 0.2 ); glutSolidSphere( 0.025f, 10.0f, 10.0f );
|
||||
glColor4f( 1.0, 1.0, 0.2, 0.1 ); glutSolidSphere( 0.030f, 10.0f, 10.0f );
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
glColor4f( 0.3, 0.4, 0.5, 0.5 );
|
||||
glm::vec3 p(_yourBodyPosition);
|
||||
p.y = 0.0005f;
|
||||
renderCircle(p, _reachableRadius, glm::vec3(0.0f, 1.0f, 0.0f), 30);
|
||||
|
||||
// if your hand is grasping, show it...
|
||||
if ( _yourHandState == 1 ) {
|
||||
if (_yourHandState == 1) {
|
||||
glPushMatrix();
|
||||
glTranslatef(_yourHandPosition.x, _yourHandPosition.y, _yourHandPosition.z);
|
||||
glColor4f( 1.0, 1.0, 0.8, 0.3 ); glutSolidSphere( 0.020f, 10.0f, 10.0f );
|
||||
|
@ -69,35 +79,61 @@ void AvatarTouch::render() {
|
|||
glColor4f( 1.0, 1.0, 0.2, 0.1 ); glutSolidSphere( 0.030f, 10.0f, 10.0f );
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
//show beam
|
||||
glm::vec3 v1(_myHandPosition);
|
||||
glm::vec3 v2(_yourHandPosition);
|
||||
|
||||
if (_handsCloseEnoughToGrasp) {
|
||||
glLineWidth(2.0);
|
||||
glColor4f( 0.7f, 0.4f, 0.1f, 0.3 );
|
||||
glBegin(GL_LINE_STRIP);
|
||||
glVertex3f( v1.x, v1.y, v1.z );
|
||||
glVertex3f( v2.x, v2.y, v2.z );
|
||||
glEnd();
|
||||
|
||||
glColor4f( 1.0f, 1.0f, 0.0f, 0.8 );
|
||||
|
||||
for (int p=0; p<NUM_POINTS; p++) {
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3f(_point[p].x, _point[p].y, _point[p].z);
|
||||
glEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//show beam
|
||||
if (_handsCloseEnoughToGrasp) {
|
||||
glLineWidth( 2.0 );
|
||||
glColor4f( 0.7f, 0.4f, 0.1f, 0.3 );
|
||||
glBegin( GL_LINE_STRIP );
|
||||
glVertex3f( v1.x, v1.y, v1.z );
|
||||
glVertex3f( v2.x, v2.y, v2.z );
|
||||
glEnd();
|
||||
|
||||
glColor4f( 1.0f, 1.0f, 0.0f, 0.8 );
|
||||
|
||||
for (int p=0; p<NUM_POINTS; p++) {
|
||||
glBegin(GL_POINTS);
|
||||
glVertex3f(_point[p].x, _point[p].y, _point[p].z);
|
||||
glEnd();
|
||||
}
|
||||
// if my hand is grasping, show it...
|
||||
if (_myHandState == 1) {
|
||||
glPushMatrix();
|
||||
glTranslatef(_myHandPosition.x, _myHandPosition.y, _myHandPosition.z);
|
||||
glColor4f( 1.0, 1.0, 0.8, 0.3 ); glutSolidSphere( 0.020f, 10.0f, 10.0f );
|
||||
glColor4f( 1.0, 1.0, 0.4, 0.2 ); glutSolidSphere( 0.025f, 10.0f, 10.0f );
|
||||
glColor4f( 1.0, 1.0, 0.2, 0.1 ); glutSolidSphere( 0.030f, 10.0f, 10.0f );
|
||||
glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AvatarTouch::simulate (float deltaTime) {
|
||||
|
||||
glm::vec3 v = _yourHandPosition - _myHandPosition;
|
||||
glm::vec3 v = _yourBodyPosition - _myBodyPosition;
|
||||
|
||||
float distance = glm::length(v);
|
||||
|
||||
if (distance < _reachableRadius ) {
|
||||
_canReachToOtherAvatar = true;
|
||||
} else {
|
||||
_canReachToOtherAvatar = false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
for (int p=0; p<NUM_POINTS; p++) {
|
||||
_point[p] = _myHandPosition + v * ( (float)p / (float)NUM_POINTS );
|
||||
_point[p].x += randFloatInRange( -THREAD_RADIUS, THREAD_RADIUS );
|
||||
_point[p].y += randFloatInRange( -THREAD_RADIUS, THREAD_RADIUS );
|
||||
_point[p].z += randFloatInRange( -THREAD_RADIUS, THREAD_RADIUS );
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -19,30 +19,35 @@ public:
|
|||
AvatarTouch();
|
||||
|
||||
void simulate(float deltaTime);
|
||||
void render();
|
||||
void render(glm::vec3 cameraPosition);
|
||||
|
||||
void setMyHandPosition ( glm::vec3 position );
|
||||
void setYourHandPosition( glm::vec3 position );
|
||||
void setMyHandState ( int state );
|
||||
void setYourHandState ( int state );
|
||||
void setMyHandPosition (glm::vec3 position);
|
||||
void setYourHandPosition(glm::vec3 position);
|
||||
void setMyBodyPosition (glm::vec3 position);
|
||||
void setYourBodyPosition(glm::vec3 position);
|
||||
void setMyHandState (int state);
|
||||
void setYourHandState (int state);
|
||||
void setReachableRadius (float r);
|
||||
void setAbleToReachOtherAvatar (bool a) {_canReachToOtherAvatar = a;}
|
||||
void setHandsCloseEnoughToGrasp(bool h) {_handsCloseEnoughToGrasp = h;}
|
||||
|
||||
void setAbleToReachOtherAvatar ( bool a ) { _canReachToOtherAvatar = a; }
|
||||
void setHandsCloseEnoughToGrasp( bool h ) { _handsCloseEnoughToGrasp = h; }
|
||||
|
||||
bool getAbleToReachOtherAvatar () { return _canReachToOtherAvatar; }
|
||||
bool getHandsCloseEnoughToGrasp() { return _handsCloseEnoughToGrasp; }
|
||||
bool getAbleToReachOtherAvatar () const {return _canReachToOtherAvatar;}
|
||||
bool getHandsCloseEnoughToGrasp() const {return _handsCloseEnoughToGrasp;}
|
||||
|
||||
private:
|
||||
|
||||
static const int NUM_POINTS = 100;
|
||||
|
||||
glm::vec3 _point [NUM_POINTS];
|
||||
glm::vec3 _myBodyPosition;
|
||||
glm::vec3 _yourBodyPosition;
|
||||
glm::vec3 _myHandPosition;
|
||||
glm::vec3 _yourHandPosition;
|
||||
int _myHandState;
|
||||
int _yourHandState;
|
||||
bool _canReachToOtherAvatar;
|
||||
bool _handsCloseEnoughToGrasp;
|
||||
float _reachableRadius;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -185,9 +185,7 @@ void drawtext(int x, int y, float scale, float rotate, float thick, int mono,
|
|||
}
|
||||
|
||||
|
||||
void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec,
|
||||
float r, float g, float b)
|
||||
{
|
||||
void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, glm::vec3 vec, float r, float g, float b) {
|
||||
//
|
||||
// Draws text on screen as stroked so it can be resized
|
||||
//
|
||||
|
@ -202,18 +200,14 @@ void drawvec3(int x, int y, float scale, float rotate, float thick, int mono, gl
|
|||
glLineWidth(thick);
|
||||
glScalef(scale, scale, 1.0);
|
||||
len = (int) strlen(vectext);
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
for (i = 0; i < len; i++) {
|
||||
if (!mono) glutStrokeCharacter(GLUT_STROKE_ROMAN, int(vectext[i]));
|
||||
else glutStrokeCharacter(GLUT_STROKE_MONO_ROMAN, int(vectext[i]));
|
||||
}
|
||||
glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
void drawGroundPlaneGrid(float size)
|
||||
{
|
||||
|
||||
void drawGroundPlaneGrid(float size) {
|
||||
glColor3f( 0.4f, 0.5f, 0.3f );
|
||||
glLineWidth(2.0);
|
||||
|
||||
|
@ -267,6 +261,51 @@ void renderDiskShadow(glm::vec3 position, glm::vec3 upDirection, float radius, f
|
|||
}
|
||||
|
||||
|
||||
|
||||
void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition) {
|
||||
glm::vec3 vectorToPosition(glm::normalize(position - cameraPosition));
|
||||
glm::vec3 right = glm::cross(vectorToPosition, glm::vec3( 0.0f, 1.0f, 0.0f));
|
||||
glm::vec3 up = glm::cross(right, vectorToPosition);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
for (int i=0; i<numSides+1; i++) {
|
||||
float r = ((float)i / (float)numSides) * PI * 2.0;
|
||||
float s = radius * sin(r);
|
||||
float c = radius * cos(r);
|
||||
|
||||
glVertex3f
|
||||
(
|
||||
position.x + right.x * s + up.x * c,
|
||||
position.y + right.y * s + up.y * c,
|
||||
position.z + right.z * s + up.z * c
|
||||
);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int numSides ) {
|
||||
glm::vec3 perp1 = glm::vec3(surfaceNormal.y, surfaceNormal.z, surfaceNormal.x);
|
||||
glm::vec3 perp2 = glm::vec3(surfaceNormal.z, surfaceNormal.x, surfaceNormal.y);
|
||||
|
||||
glBegin(GL_LINE_STRIP);
|
||||
|
||||
for (int i=0; i<numSides+1; i++) {
|
||||
float r = ((float)i / (float)numSides) * PI * 2.0;
|
||||
float s = radius * sin(r);
|
||||
float c = radius * cos(r);
|
||||
glVertex3f
|
||||
(
|
||||
position.x + perp1.x * s + perp2.x * c,
|
||||
position.y + perp1.y * s + perp2.y * c,
|
||||
position.z + perp1.z * s + perp2.z * c
|
||||
);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size ) {
|
||||
glm::vec3 pRight = position + orientation.getRight() * size;
|
||||
glm::vec3 pUp = position + orientation.getUp() * size;
|
||||
|
|
|
@ -48,6 +48,9 @@ void renderDiskShadow(glm::vec3 position, glm::vec3 upDirection, float radius, f
|
|||
|
||||
void renderOrientationDirections( glm::vec3 position, Orientation orientation, float size );
|
||||
|
||||
void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition);
|
||||
void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int numSides );
|
||||
|
||||
|
||||
class oTestCase {
|
||||
public:
|
||||
|
|
|
@ -692,14 +692,14 @@ void displaySide(Camera& whichCamera) {
|
|||
float sphereRadius = 0.25f;
|
||||
glColor3f(1,0,0);
|
||||
glPushMatrix();
|
||||
glutSolidSphere( sphereRadius, 15, 15 );
|
||||
glutSolidSphere(sphereRadius, 15, 15);
|
||||
glPopMatrix();
|
||||
|
||||
//draw a grid ground plane....
|
||||
drawGroundPlaneGrid(10.f);
|
||||
|
||||
// Draw voxels
|
||||
if ( showingVoxels )
|
||||
if (showingVoxels)
|
||||
{
|
||||
voxels.render();
|
||||
}
|
||||
|
@ -710,7 +710,7 @@ void displaySide(Camera& whichCamera) {
|
|||
for (AgentList::iterator agent = agentList->begin(); agent != agentList->end(); agent++) {
|
||||
if (agent->getLinkedData() != NULL && agent->getType() == AGENT_TYPE_AVATAR) {
|
||||
Avatar *avatar = (Avatar *)agent->getLinkedData();
|
||||
avatar->render(0);
|
||||
avatar->render(0, ::myCamera.getPosition());
|
||||
}
|
||||
}
|
||||
agentList->unlock();
|
||||
|
@ -722,7 +722,7 @@ void displaySide(Camera& whichCamera) {
|
|||
if (::frustumOn) renderViewFrustum(::viewFrustum);
|
||||
|
||||
//Render my own avatar
|
||||
myAvatar.render(::lookingInMirror);
|
||||
myAvatar.render(::lookingInMirror, ::myCamera.getPosition());
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
@ -984,15 +984,15 @@ void display(void)
|
|||
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
||||
|
||||
// camera settings
|
||||
if ( ::lookingInMirror ) {
|
||||
if (::lookingInMirror) {
|
||||
// set the camera to looking at my own face
|
||||
myCamera.setTargetPosition ( myAvatar.getHeadPosition() );
|
||||
myCamera.setTargetYaw ( myAvatar.getBodyYaw() - 180.0f ); // 180 degrees from body yaw
|
||||
myCamera.setPitch ( 0.0 );
|
||||
myCamera.setRoll ( 0.0 );
|
||||
myCamera.setUpShift ( 0.0 );
|
||||
myCamera.setDistance ( 0.2 );
|
||||
myCamera.setTightness ( 100.0f );
|
||||
myCamera.setTargetPosition (myAvatar.getHeadPosition());
|
||||
myCamera.setTargetYaw (myAvatar.getBodyYaw() - 180.0f); // 180 degrees from body yaw
|
||||
myCamera.setPitch (0.0);
|
||||
myCamera.setRoll (0.0);
|
||||
myCamera.setUpShift (0.0);
|
||||
myCamera.setDistance (0.2);
|
||||
myCamera.setTightness (100.0f);
|
||||
} else {
|
||||
|
||||
//float firstPersonPitch = 20.0f;
|
||||
|
@ -1010,36 +1010,24 @@ void display(void)
|
|||
float thirdPersonDistance = 1.2f;
|
||||
float thirdPersonTightness = 8.0f;
|
||||
|
||||
if ( USING_FIRST_PERSON_EFFECT ) {
|
||||
if (USING_FIRST_PERSON_EFFECT) {
|
||||
float ff = 0.0;
|
||||
float min = 0.1;
|
||||
float max = 0.5;
|
||||
|
||||
if ( myAvatar.getIsNearInteractingOther()){
|
||||
if ( myAvatar.getSpeed() < max ) {
|
||||
if (myAvatar.getIsNearInteractingOther()){
|
||||
if (myAvatar.getSpeed() < max) {
|
||||
|
||||
float s = (myAvatar.getSpeed()- min)/max ;
|
||||
ff = 1.0 - s;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if ( ff < 0.8 ) {
|
||||
myAvatar.setDisplayingHead( true );
|
||||
} else {
|
||||
myAvatar.setDisplayingHead( false );
|
||||
}
|
||||
*/
|
||||
|
||||
//printf( "ff = %f\n", ff );
|
||||
|
||||
myCamera.setPitch ( thirdPersonPitch + ff * ( firstPersonPitch - thirdPersonPitch ));
|
||||
myCamera.setUpShift ( thirdPersonUpShift + ff * ( firstPersonUpShift - thirdPersonUpShift ));
|
||||
myCamera.setDistance ( thirdPersonDistance + ff * ( firstPersonDistance - thirdPersonDistance ));
|
||||
myCamera.setTightness ( thirdPersonTightness + ff * ( firstPersonTightness - thirdPersonTightness ));
|
||||
myCamera.setPitch (thirdPersonPitch + ff * (firstPersonPitch - thirdPersonPitch ));
|
||||
myCamera.setUpShift (thirdPersonUpShift + ff * (firstPersonUpShift - thirdPersonUpShift ));
|
||||
myCamera.setDistance (thirdPersonDistance + ff * (firstPersonDistance - thirdPersonDistance ));
|
||||
myCamera.setTightness (thirdPersonTightness + ff * (firstPersonTightness - thirdPersonTightness));
|
||||
|
||||
|
||||
|
||||
// this version uses a ramp-up/ramp-down timer in the camera to determine shift between first and thirs-person view
|
||||
/*
|
||||
if ( myAvatar.getSpeed() < 0.02 ) {
|
||||
|
@ -1073,13 +1061,13 @@ void display(void)
|
|||
myCamera.setTightness(thirdPersonTightness);
|
||||
}
|
||||
|
||||
myCamera.setTargetPosition( myAvatar.getHeadPosition() );
|
||||
myCamera.setTargetYaw ( myAvatar.getBodyYaw() );
|
||||
myCamera.setRoll ( 0.0 );
|
||||
myCamera.setTargetPosition(myAvatar.getHeadPosition());
|
||||
myCamera.setTargetYaw (myAvatar.getBodyYaw());
|
||||
myCamera.setRoll (0.0);
|
||||
}
|
||||
|
||||
// important...
|
||||
myCamera.update( 1.f/FPS );
|
||||
myCamera.update(1.f/FPS);
|
||||
|
||||
// Note: whichCamera is used to pick between the normal camera myCamera for our
|
||||
// main camera, vs, an alternate camera. The alternate camera we support right now
|
||||
|
@ -1095,11 +1083,11 @@ void display(void)
|
|||
if (::viewFrustumFromOffset && ::frustumOn) {
|
||||
|
||||
// set the camera to third-person view but offset so we can see the frustum
|
||||
viewFrustumOffsetCamera.setTargetYaw( ::viewFrustumOffsetYaw + myAvatar.getBodyYaw() );
|
||||
viewFrustumOffsetCamera.setPitch ( ::viewFrustumOffsetPitch );
|
||||
viewFrustumOffsetCamera.setRoll ( ::viewFrustumOffsetRoll );
|
||||
viewFrustumOffsetCamera.setUpShift ( ::viewFrustumOffsetUp );
|
||||
viewFrustumOffsetCamera.setDistance ( ::viewFrustumOffsetDistance );
|
||||
viewFrustumOffsetCamera.setTargetYaw(::viewFrustumOffsetYaw + myAvatar.getBodyYaw() );
|
||||
viewFrustumOffsetCamera.setPitch (::viewFrustumOffsetPitch );
|
||||
viewFrustumOffsetCamera.setRoll (::viewFrustumOffsetRoll );
|
||||
viewFrustumOffsetCamera.setUpShift (::viewFrustumOffsetUp );
|
||||
viewFrustumOffsetCamera.setDistance (::viewFrustumOffsetDistance);
|
||||
viewFrustumOffsetCamera.update(1.f/FPS);
|
||||
whichCamera = viewFrustumOffsetCamera;
|
||||
}
|
||||
|
@ -1109,11 +1097,11 @@ void display(void)
|
|||
// or could be viewFrustumOffsetCamera if in offset mode
|
||||
// I changed the ordering here - roll is FIRST (JJV)
|
||||
|
||||
glRotatef ( whichCamera.getRoll(), IDENTITY_FRONT.x, IDENTITY_FRONT.y, IDENTITY_FRONT.z );
|
||||
glRotatef ( whichCamera.getPitch(), IDENTITY_RIGHT.x, IDENTITY_RIGHT.y, IDENTITY_RIGHT.z );
|
||||
glRotatef ( 180.0 - whichCamera.getYaw(), IDENTITY_UP.x, IDENTITY_UP.y, IDENTITY_UP.z );
|
||||
glRotatef ( whichCamera.getRoll(), IDENTITY_FRONT.x, IDENTITY_FRONT.y, IDENTITY_FRONT.z);
|
||||
glRotatef ( whichCamera.getPitch(), IDENTITY_RIGHT.x, IDENTITY_RIGHT.y, IDENTITY_RIGHT.z);
|
||||
glRotatef (180.0 - whichCamera.getYaw(), IDENTITY_UP.x, IDENTITY_UP.y, IDENTITY_UP.z );
|
||||
|
||||
glTranslatef( -whichCamera.getPosition().x, -whichCamera.getPosition().y, -whichCamera.getPosition().z );
|
||||
glTranslatef(-whichCamera.getPosition().x, -whichCamera.getPosition().y, -whichCamera.getPosition().z);
|
||||
|
||||
if (::oculusOn) {
|
||||
displayOculus(whichCamera);
|
||||
|
@ -1666,18 +1654,16 @@ void idle(void) {
|
|||
|
||||
// update behaviors for avatar hand movement: handControl takes mouse values as input,
|
||||
// and gives back 3D values modulated for smooth transitioning between interaction modes.
|
||||
handControl.update( mouseX, mouseY );
|
||||
myAvatar.setHandMovementValues( handControl.getValues() );
|
||||
handControl.update(mouseX, mouseY);
|
||||
myAvatar.setHandMovementValues(handControl.getValues());
|
||||
|
||||
// tell my avatar if the mouse is being pressed...
|
||||
if ( mousePressed == 1 ) {
|
||||
myAvatar.setMousePressed( true );
|
||||
} else {
|
||||
myAvatar.setMousePressed( false );
|
||||
}
|
||||
|
||||
if (mousePressed) {
|
||||
myAvatar.setMousePressed(mousePressed);
|
||||
}
|
||||
|
||||
// walking triggers the handControl to stop
|
||||
if ( myAvatar.getMode() == AVATAR_MODE_WALKING ) {
|
||||
if (myAvatar.getMode() == AVATAR_MODE_WALKING) {
|
||||
handControl.stop();
|
||||
}
|
||||
|
||||
|
@ -1870,7 +1856,7 @@ int main(int argc, const char * argv[])
|
|||
|
||||
#ifdef _WIN32
|
||||
WSADATA WsaData;
|
||||
int wsaresult = WSAStartup( MAKEWORD(2,2), &WsaData );
|
||||
int wsaresult = WSAStartup(MAKEWORD(2,2), &WsaData);
|
||||
#endif
|
||||
|
||||
// start the agentList threads
|
||||
|
|
Loading…
Reference in a new issue