(1) added a few methods to orientation; (2) fixed Eve's height; (3) added pitch and roll members to Avatar (not used yet); added avatar pull from handshake;

This commit is contained in:
Jeffrey Ventrella 2013-05-01 15:38:55 -07:00
parent c88a7f8f55
commit aeb545656e
5 changed files with 51 additions and 50 deletions

View file

@ -113,7 +113,8 @@ int main(int argc, const char* argv[]) {
// move eve away from the origin
// pick a random point inside a 10x10 grid
eve.setPosition(glm::vec3(randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION), 0.4,
eve.setPosition(glm::vec3(randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION),
0.32,
randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION)));
// face any instance of eve down the z-axis
@ -121,7 +122,7 @@ int main(int argc, const char* argv[]) {
// put her hand out so somebody can shake it
eve.setHandPosition(glm::vec3(eve.getPosition()[0] - 0.2,
0.32, // this is the same as the pelvis standing height (as of 4/26/13)
0.2, // this is the same as the pelvis standing height (as of 4/26/13)
eve.getPosition()[2] + 0.1));
// read eve's audio data
AudioInjector eveAudioInjector("/etc/highfidelity/eve/resources/eve.raw");

View file

@ -78,7 +78,9 @@ Avatar::Avatar(bool isMine) {
_bodyYaw = -90.0;
_bodyPitch = 0.0;
_bodyRoll = 0.0;
_bodyPitchDelta = 0.0;
_bodyYawDelta = 0.0;
_bodyRollDelta = 0.0;
_mousePressed = false;
_mode = AVATAR_MODE_STANDING;
_isMine = isMine;
@ -95,34 +97,6 @@ Avatar::Avatar(bool isMine) {
for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = false;
/*
_head.mouthPitch = 0;
_head.mouthYaw = 0;
_head.mouthWidth = 1.0;
_head.mouthHeight = 0.2;
_head.eyeballPitch[0] = 0;
_head.eyeballPitch[1] = 0;
_head.eyeballScaleX = 1.2;
_head.eyeballScaleY = 1.5;
_head.eyeballScaleZ = 1.0;
_head.eyeballYaw[0] = 0;
_head.eyeballYaw[1] = 0;
_head.pitchTarget = 0;
_head.yawTarget = 0;
_head.noiseEnvelope = 1.0;
_head.pupilConverge = 10.0;
_head.leanForward = 0.0;
_head.leanSideways = 0.0;
_head.eyeContact = 1;
_head.eyeContactTarget = LEFT_EYE;
_head.scale = 1.0;
_head.audioAttack = 0.0;
_head.averageLoudness = 0.0;
_head.lastLoudness = 0.0;
_head.browAudioLift = 0.0;
_head.noise = 0;
*/
_head.pupilSize = 0.10;
_head.interPupilDistance = 0.6;
_head.interBrowDistance = 0.75;
@ -166,11 +140,9 @@ Avatar::Avatar(bool isMine) {
_renderPitch = 0.0;
_sphere = NULL;
_interactingOther = NULL;
_closeEnoughToHoldHands = false;
//_interactingOtherIsNearby = false;
_closeEnoughToHoldHands = false; //_interactingOtherIsNearby = false;
_handHoldingPosition = glm::vec3( 0.0, 0.0, 0.0 );
initializeSkeleton();
if (iris_texture.size() == 0) {
@ -192,11 +164,12 @@ Avatar::Avatar(const Avatar &otherAvatar) {
_thrust = otherAvatar._thrust;
_rotation = otherAvatar._rotation;
_closeEnoughToHoldHands = otherAvatar._closeEnoughToHoldHands;
//_interactingOtherIsNearby = otherAvatar._interactingOtherIsNearby;
_bodyYaw = otherAvatar._bodyYaw;
_bodyPitch = otherAvatar._bodyPitch;
_bodyRoll = otherAvatar._bodyRoll;
_bodyPitchDelta = otherAvatar._bodyPitchDelta;
_bodyYawDelta = otherAvatar._bodyYawDelta;
_bodyRollDelta = otherAvatar._bodyRollDelta;
_mousePressed = otherAvatar._mousePressed;
_mode = otherAvatar._mode;
_isMine = otherAvatar._isMine;
@ -406,10 +379,9 @@ void Avatar::simulate(float deltaTime) {
_handHoldingPosition += vectorToMyHand * MY_HAND_HOLDING_PULL;
_bone[ AVATAR_BONE_RIGHT_HAND ].position = _handHoldingPosition;
//if ( glm::length(vectorToOtherHand) > 0.2 ) {
// _velocity += vectorToOtherHand;
//}
if ( glm::length(vectorToOtherHand) > _maxArmLength * 0.9 ) {
_velocity += vectorToOtherHand;
}
}
}
}
@ -477,8 +449,10 @@ void Avatar::simulate(float deltaTime) {
_bodyYaw += _bodyYawDelta * deltaTime;
}
// decay body yaw delta
_bodyYawDelta *= (1.0 - TEST_YAW_DECAY * deltaTime);
// decay body rotation deltas
_bodyPitchDelta *= (1.0 - BODY_PITCH_DECAY * deltaTime);
_bodyYawDelta *= (1.0 - BODY_YAW_DECAY * deltaTime);
_bodyRollDelta *= (1.0 - BODY_ROLL_DECAY * deltaTime);
// add thrust to velocity
_velocity += _thrust * deltaTime;
@ -813,7 +787,7 @@ void Avatar::renderHead(bool lookingInMirror) {
glEnable(GL_RESCALE_NORMAL);
// show head orientation
renderOrientationDirections( _bone[ AVATAR_BONE_HEAD ].springyPosition, _bone[ AVATAR_BONE_HEAD ].orientation, 0.2f );
//renderOrientationDirections( _bone[ AVATAR_BONE_HEAD ].springyPosition, _bone[ AVATAR_BONE_HEAD ].orientation, 0.2f );
glPushMatrix();
@ -831,13 +805,13 @@ void Avatar::renderHead(bool lookingInMirror) {
glScalef( 0.03, 0.03, 0.03 );
if (lookingInMirror) {
glRotatef(_bodyYaw - _headYaw, 0, 1, 0);
glRotatef(_bodyYaw - _headYaw, 0, 1, 0);
glRotatef(_bodyPitch + _headPitch, 1, 0, 0);
glRotatef(_bodyRoll - _headRoll, 0, 0, 1);
glRotatef(_bodyRoll - _headRoll, 0, 0, 1);
} else {
glRotatef(_bodyYaw + _headYaw, 0, 1, 0);
glRotatef(_bodyYaw + _headYaw, 0, 1, 0);
glRotatef(_bodyPitch + _headPitch, 1, 0, 0);
glRotatef(_bodyRoll + _headRoll, 0, 0, 1);
glRotatef(_bodyRoll + _headRoll, 0, 0, 1);
}
glScalef(2.0, 2.0, 2.0);

View file

@ -148,7 +148,9 @@ private:
const float DECAY = 0.1;
const float THRUST_MAG = 1200.0;
const float YAW_MAG = 500.0;
const float TEST_YAW_DECAY = 5.0;
const float BODY_PITCH_DECAY = 5.0;
const float BODY_YAW_DECAY = 5.0;
const float BODY_ROLL_DECAY = 5.0;
const float LIN_VEL_DECAY = 5.0;
const float MY_HAND_HOLDING_PULL = 0.2;
const float YOUR_HAND_HOLDING_PULL = 1.0;
@ -228,7 +230,9 @@ private:
glm::vec3 _TEST_bigSpherePosition;
float _TEST_bigSphereRadius;
bool _mousePressed;
float _bodyPitchDelta;
float _bodyYawDelta;
float _bodyRollDelta;
bool _usingBodySprings;
glm::vec3 _movedHandOffset;
glm::quat _rotation; // the rotation of the avatar body as a whole expressed as a quaternion
@ -252,7 +256,6 @@ private:
glm::vec3 _transmitterInitialReading;
Avatar* _interactingOther;
bool _closeEnoughToHoldHands;
//bool _interactingOtherIsNearby;
float _pelvisStandingHeight;
float _height;
Balls* _balls;

View file

@ -93,6 +93,25 @@ void Orientation::roll( float angle ) {
}
}
void Orientation::rotate( float p, float y, float r ) {
pitch(p);
yaw (y);
roll (r);
}
void Orientation::rotate( glm::vec3 eulerAngles ) {
//this needs to be optimized!
pitch(eulerAngles.x);
yaw (eulerAngles.y);
roll (eulerAngles.z);
}
void Orientation::rotate( glm::quat rotation ) {
rotateAndGenerateDirections(rotation);
}
void Orientation::rotateAndGenerateDirections( glm::quat rotation ) {
quat = quat * rotation;

View file

@ -24,9 +24,13 @@ public:
void set( Orientation );
void setToIdentity();
void yaw ( float );
void pitch( float );
void roll ( float );
void pitch( float p );
void yaw ( float y );
void roll ( float r );
void rotate( float pitch, float yaw, float roll );
void rotate( glm::vec3 EulerAngles );
void rotate( glm::quat quaternion );
const glm::vec3 & getRight() const { return right; }
const glm::vec3 & getUp () const { return up; }