mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:28:46 +02:00
(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:
parent
c88a7f8f55
commit
aeb545656e
5 changed files with 51 additions and 50 deletions
|
@ -113,7 +113,8 @@ int main(int argc, const char* argv[]) {
|
||||||
// move eve away from the origin
|
// move eve away from the origin
|
||||||
// pick a random point inside a 10x10 grid
|
// 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)));
|
randFloatInRange(-RANDOM_POSITION_MAX_DIMENSION, RANDOM_POSITION_MAX_DIMENSION)));
|
||||||
|
|
||||||
// face any instance of eve down the z-axis
|
// 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
|
// put her hand out so somebody can shake it
|
||||||
eve.setHandPosition(glm::vec3(eve.getPosition()[0] - 0.2,
|
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));
|
eve.getPosition()[2] + 0.1));
|
||||||
// read eve's audio data
|
// read eve's audio data
|
||||||
AudioInjector eveAudioInjector("/etc/highfidelity/eve/resources/eve.raw");
|
AudioInjector eveAudioInjector("/etc/highfidelity/eve/resources/eve.raw");
|
||||||
|
|
|
@ -78,7 +78,9 @@ Avatar::Avatar(bool isMine) {
|
||||||
_bodyYaw = -90.0;
|
_bodyYaw = -90.0;
|
||||||
_bodyPitch = 0.0;
|
_bodyPitch = 0.0;
|
||||||
_bodyRoll = 0.0;
|
_bodyRoll = 0.0;
|
||||||
|
_bodyPitchDelta = 0.0;
|
||||||
_bodyYawDelta = 0.0;
|
_bodyYawDelta = 0.0;
|
||||||
|
_bodyRollDelta = 0.0;
|
||||||
_mousePressed = false;
|
_mousePressed = false;
|
||||||
_mode = AVATAR_MODE_STANDING;
|
_mode = AVATAR_MODE_STANDING;
|
||||||
_isMine = isMine;
|
_isMine = isMine;
|
||||||
|
@ -95,34 +97,6 @@ Avatar::Avatar(bool isMine) {
|
||||||
|
|
||||||
for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = false;
|
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.pupilSize = 0.10;
|
||||||
_head.interPupilDistance = 0.6;
|
_head.interPupilDistance = 0.6;
|
||||||
_head.interBrowDistance = 0.75;
|
_head.interBrowDistance = 0.75;
|
||||||
|
@ -166,11 +140,9 @@ Avatar::Avatar(bool isMine) {
|
||||||
_renderPitch = 0.0;
|
_renderPitch = 0.0;
|
||||||
_sphere = NULL;
|
_sphere = NULL;
|
||||||
_interactingOther = NULL;
|
_interactingOther = NULL;
|
||||||
_closeEnoughToHoldHands = false;
|
_closeEnoughToHoldHands = false; //_interactingOtherIsNearby = false;
|
||||||
//_interactingOtherIsNearby = false;
|
|
||||||
_handHoldingPosition = glm::vec3( 0.0, 0.0, 0.0 );
|
_handHoldingPosition = glm::vec3( 0.0, 0.0, 0.0 );
|
||||||
|
|
||||||
|
|
||||||
initializeSkeleton();
|
initializeSkeleton();
|
||||||
|
|
||||||
if (iris_texture.size() == 0) {
|
if (iris_texture.size() == 0) {
|
||||||
|
@ -192,11 +164,12 @@ Avatar::Avatar(const Avatar &otherAvatar) {
|
||||||
_thrust = otherAvatar._thrust;
|
_thrust = otherAvatar._thrust;
|
||||||
_rotation = otherAvatar._rotation;
|
_rotation = otherAvatar._rotation;
|
||||||
_closeEnoughToHoldHands = otherAvatar._closeEnoughToHoldHands;
|
_closeEnoughToHoldHands = otherAvatar._closeEnoughToHoldHands;
|
||||||
//_interactingOtherIsNearby = otherAvatar._interactingOtherIsNearby;
|
|
||||||
_bodyYaw = otherAvatar._bodyYaw;
|
_bodyYaw = otherAvatar._bodyYaw;
|
||||||
_bodyPitch = otherAvatar._bodyPitch;
|
_bodyPitch = otherAvatar._bodyPitch;
|
||||||
_bodyRoll = otherAvatar._bodyRoll;
|
_bodyRoll = otherAvatar._bodyRoll;
|
||||||
|
_bodyPitchDelta = otherAvatar._bodyPitchDelta;
|
||||||
_bodyYawDelta = otherAvatar._bodyYawDelta;
|
_bodyYawDelta = otherAvatar._bodyYawDelta;
|
||||||
|
_bodyRollDelta = otherAvatar._bodyRollDelta;
|
||||||
_mousePressed = otherAvatar._mousePressed;
|
_mousePressed = otherAvatar._mousePressed;
|
||||||
_mode = otherAvatar._mode;
|
_mode = otherAvatar._mode;
|
||||||
_isMine = otherAvatar._isMine;
|
_isMine = otherAvatar._isMine;
|
||||||
|
@ -406,10 +379,9 @@ void Avatar::simulate(float deltaTime) {
|
||||||
_handHoldingPosition += vectorToMyHand * MY_HAND_HOLDING_PULL;
|
_handHoldingPosition += vectorToMyHand * MY_HAND_HOLDING_PULL;
|
||||||
_bone[ AVATAR_BONE_RIGHT_HAND ].position = _handHoldingPosition;
|
_bone[ AVATAR_BONE_RIGHT_HAND ].position = _handHoldingPosition;
|
||||||
|
|
||||||
|
if ( glm::length(vectorToOtherHand) > _maxArmLength * 0.9 ) {
|
||||||
//if ( glm::length(vectorToOtherHand) > 0.2 ) {
|
_velocity += vectorToOtherHand;
|
||||||
// _velocity += vectorToOtherHand;
|
}
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -477,8 +449,10 @@ void Avatar::simulate(float deltaTime) {
|
||||||
_bodyYaw += _bodyYawDelta * deltaTime;
|
_bodyYaw += _bodyYawDelta * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
// decay body yaw delta
|
// decay body rotation deltas
|
||||||
_bodyYawDelta *= (1.0 - TEST_YAW_DECAY * deltaTime);
|
_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
|
// add thrust to velocity
|
||||||
_velocity += _thrust * deltaTime;
|
_velocity += _thrust * deltaTime;
|
||||||
|
@ -813,7 +787,7 @@ void Avatar::renderHead(bool lookingInMirror) {
|
||||||
glEnable(GL_RESCALE_NORMAL);
|
glEnable(GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
// show head orientation
|
// 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();
|
glPushMatrix();
|
||||||
|
|
||||||
|
@ -831,13 +805,13 @@ void Avatar::renderHead(bool lookingInMirror) {
|
||||||
glScalef( 0.03, 0.03, 0.03 );
|
glScalef( 0.03, 0.03, 0.03 );
|
||||||
|
|
||||||
if (lookingInMirror) {
|
if (lookingInMirror) {
|
||||||
glRotatef(_bodyYaw - _headYaw, 0, 1, 0);
|
glRotatef(_bodyYaw - _headYaw, 0, 1, 0);
|
||||||
glRotatef(_bodyPitch + _headPitch, 1, 0, 0);
|
glRotatef(_bodyPitch + _headPitch, 1, 0, 0);
|
||||||
glRotatef(_bodyRoll - _headRoll, 0, 0, 1);
|
glRotatef(_bodyRoll - _headRoll, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
glRotatef(_bodyYaw + _headYaw, 0, 1, 0);
|
glRotatef(_bodyYaw + _headYaw, 0, 1, 0);
|
||||||
glRotatef(_bodyPitch + _headPitch, 1, 0, 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);
|
glScalef(2.0, 2.0, 2.0);
|
||||||
|
|
|
@ -148,7 +148,9 @@ private:
|
||||||
const float DECAY = 0.1;
|
const float DECAY = 0.1;
|
||||||
const float THRUST_MAG = 1200.0;
|
const float THRUST_MAG = 1200.0;
|
||||||
const float YAW_MAG = 500.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 LIN_VEL_DECAY = 5.0;
|
||||||
const float MY_HAND_HOLDING_PULL = 0.2;
|
const float MY_HAND_HOLDING_PULL = 0.2;
|
||||||
const float YOUR_HAND_HOLDING_PULL = 1.0;
|
const float YOUR_HAND_HOLDING_PULL = 1.0;
|
||||||
|
@ -228,7 +230,9 @@ private:
|
||||||
glm::vec3 _TEST_bigSpherePosition;
|
glm::vec3 _TEST_bigSpherePosition;
|
||||||
float _TEST_bigSphereRadius;
|
float _TEST_bigSphereRadius;
|
||||||
bool _mousePressed;
|
bool _mousePressed;
|
||||||
|
float _bodyPitchDelta;
|
||||||
float _bodyYawDelta;
|
float _bodyYawDelta;
|
||||||
|
float _bodyRollDelta;
|
||||||
bool _usingBodySprings;
|
bool _usingBodySprings;
|
||||||
glm::vec3 _movedHandOffset;
|
glm::vec3 _movedHandOffset;
|
||||||
glm::quat _rotation; // the rotation of the avatar body as a whole expressed as a quaternion
|
glm::quat _rotation; // the rotation of the avatar body as a whole expressed as a quaternion
|
||||||
|
@ -252,7 +256,6 @@ private:
|
||||||
glm::vec3 _transmitterInitialReading;
|
glm::vec3 _transmitterInitialReading;
|
||||||
Avatar* _interactingOther;
|
Avatar* _interactingOther;
|
||||||
bool _closeEnoughToHoldHands;
|
bool _closeEnoughToHoldHands;
|
||||||
//bool _interactingOtherIsNearby;
|
|
||||||
float _pelvisStandingHeight;
|
float _pelvisStandingHeight;
|
||||||
float _height;
|
float _height;
|
||||||
Balls* _balls;
|
Balls* _balls;
|
||||||
|
|
|
@ -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 ) {
|
void Orientation::rotateAndGenerateDirections( glm::quat rotation ) {
|
||||||
|
|
||||||
quat = quat * rotation;
|
quat = quat * rotation;
|
||||||
|
|
|
@ -24,9 +24,13 @@ public:
|
||||||
void set( Orientation );
|
void set( Orientation );
|
||||||
void setToIdentity();
|
void setToIdentity();
|
||||||
|
|
||||||
void yaw ( float );
|
void pitch( float p );
|
||||||
void pitch( float );
|
void yaw ( float y );
|
||||||
void roll ( float );
|
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 & getRight() const { return right; }
|
||||||
const glm::vec3 & getUp () const { return up; }
|
const glm::vec3 & getUp () const { return up; }
|
||||||
|
|
Loading…
Reference in a new issue