added - and then removed - some orientation-related tests

This commit is contained in:
Jeffrey Ventrella 2013-04-22 10:29:14 -07:00
parent 08105c3898
commit 2e402c3b17
3 changed files with 43 additions and 25 deletions

View file

@ -48,6 +48,7 @@ unsigned int iris_texture_height = 256;
Head::Head(bool isMine) {
_orientation.setToIdentity();
_velocity = glm::vec3( 0.0, 0.0, 0.0 );
_thrust = glm::vec3( 0.0, 0.0, 0.0 );
_rotation = glm::quat( 0.0f, 0.0f, 0.0f, 0.0f );
@ -164,7 +165,6 @@ Head::Head(const Head &otherAvatar) {
_usingBodySprings = otherAvatar._usingBodySprings;
_springForce = otherAvatar._springForce;
_springVelocityDecay = otherAvatar._springVelocityDecay;
_orientation.set( otherAvatar._orientation );
//for (int o=0;o<NUM_OTHER_AVATARS; o++) {
@ -1006,11 +1006,27 @@ void Head::updateSkeleton() {
_orientation.setToIdentity();
_orientation.yaw( _bodyYaw );
//test! - make sure this does what expected: st rotation to be identity PLUS _bodyYaw
//_rotation = glm::angleAxis( _bodyYaw, _orientation.up );
/*
glm::quat quaternion
(
glm::vec3
(
_bodyPitch * PI_OVER_180,
_bodyYaw * PI_OVER_180,
_bodyRoll * PI_OVER_180
)
);
//glm::quat yaw_rotation = glm::angleAxis( _bodyYaw, _orientation.up );
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:
@ -1138,6 +1154,7 @@ void Head::updateHandMovement() {
+ _orientation.getUp() * -_movedHandOffset.y * 0.5f
+ _orientation.getFront() * -_movedHandOffset.y;
_bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement;
//if holding hands, add a pull to the hand...
@ -1207,6 +1224,7 @@ void Head::updateHandMovement() {
//-----------------------------------------------------------------------------
glm::vec3 newElbowPosition = _bone[ AVATAR_BONE_RIGHT_SHOULDER ].position;
newElbowPosition += armVector * ONE_HALF;
//glm::vec3 perpendicular = glm::cross( frontDirection, armVector );
glm::vec3 perpendicular = glm::cross( _orientation.getFront(), armVector );
newElbowPosition += perpendicular * ( 1.0f - ( _maxArmLength / distance ) ) * ONE_HALF;

View file

@ -223,18 +223,20 @@ class Head : public AvatarData {
glm::vec3 _movedHandOffset;
float _springVelocityDecay;
float _springForce;
glm::quat _rotation; // the rotation of the avatar body as a whole
glm::quat _rotation; // the rotation of the avatar body as a whole expressed as a quaternion
AvatarBone _bone[ NUM_AVATAR_BONES ];
AvatarMode _mode;
glm::dvec3 _velocity;
glm::vec3 _thrust;
float _maxArmLength;
Orientation _orientation;
int _driveKeys[MAX_DRIVE_KEYS];
GLUquadric* _sphere;
float _renderYaw;
float _renderPitch; // Pitch from view frustum when this is own head.
//
// Related to getting transmitter UDP data used to animate the avatar hand
//

View file

@ -1543,8 +1543,6 @@ void mouseoverFunc( int x, int y)
void attachNewHeadToAgent(Agent *newAgent) {
if (newAgent->getLinkedData() == NULL) {
newAgent->setLinkedData(new Head(false));