Merge pull request #969 from birarda/master

remove the sphere from the ground plane
This commit is contained in:
ZappoMan 2013-09-20 15:56:51 -07:00
commit ceaa3722be
3 changed files with 0 additions and 53 deletions

View file

@ -57,7 +57,6 @@ const float HEAD_RATE_MAX = 50.f;
const float SKIN_COLOR[] = {1.0, 0.84, 0.66};
const float DARK_SKIN_COLOR[] = {0.9, 0.78, 0.63};
const int NUM_BODY_CONE_SIDES = 9;
const bool usingBigSphereCollisionTest = true;
const float chatMessageScale = 0.0015;
const float chatMessageHeight = 0.20;
@ -88,8 +87,6 @@ Avatar::Avatar(Node* owningNode) :
_head(this),
_hand(this),
_ballSpringsInitialized(false),
_TEST_bigSphereRadius(0.5f),
_TEST_bigSpherePosition(5.0f, _TEST_bigSphereRadius, 5.0f),
_bodyYawDelta(0.0f),
_movedHandOffset(0.0f, 0.0f, 0.0f),
_mode(AVATAR_MODE_STANDING),
@ -365,12 +362,6 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter, float gyroCamer
// update body balls
updateBodyBalls(deltaTime);
// test for avatar collision response with the big sphere
if (usingBigSphereCollisionTest && _isCollisionsOn) {
updateCollisionWithSphere(_TEST_bigSpherePosition, _TEST_bigSphereRadius, deltaTime);
}
//apply the head lean values to the ball positions...
if (USING_HEAD_LEAN) {
if (fabs(_head.getLeanSideways() + _head.getLeanForward()) > 0.0f) {
@ -449,32 +440,6 @@ void Avatar::updateHandMovementAndTouching(float deltaTime, bool enableHandMovem
}
}
void Avatar::updateCollisionWithSphere(glm::vec3 position, float radius, float deltaTime) {
float myBodyApproximateBoundingRadius = 1.0f;
glm::vec3 vectorFromMyBodyToBigSphere(_position - position);
float distanceToBigSphere = glm::length(vectorFromMyBodyToBigSphere);
if (distanceToBigSphere < myBodyApproximateBoundingRadius + radius) {
for (int b = 0; b < NUM_AVATAR_BODY_BALLS; b++) {
glm::vec3 vectorFromBallToBigSphereCenter(_bodyBall[b].position - position);
float distanceToBigSphereCenter = glm::length(vectorFromBallToBigSphereCenter);
float combinedRadius = _bodyBall[b].radius + radius;
if (distanceToBigSphereCenter < combinedRadius) {
if (distanceToBigSphereCenter > 0.0) {
glm::vec3 directionVector = vectorFromBallToBigSphereCenter / distanceToBigSphereCenter;
float penetration = 1.0 - (distanceToBigSphereCenter / combinedRadius);
glm::vec3 collisionForce = vectorFromBallToBigSphereCenter * penetration;
_velocity += collisionForce * 40.0f * deltaTime;
_bodyBall[b].position = position + directionVector * combinedRadius;
}
}
}
}
}
static TextRenderer* textRenderer() {
static TextRenderer* renderer = new TextRenderer(SANS_FONT_FAMILY, 24, -1, false, TextRenderer::SHADOW_EFFECT);
return renderer;

View file

@ -203,8 +203,6 @@ protected:
Hand _hand;
Skeleton _skeleton;
bool _ballSpringsInitialized;
float _TEST_bigSphereRadius;
glm::vec3 _TEST_bigSpherePosition;
float _bodyYawDelta;
glm::vec3 _movedHandOffset;
AvatarBall _bodyBall[ NUM_AVATAR_BODY_BALLS ];
@ -234,7 +232,6 @@ protected:
glm::vec3 getBodyUpDirection() const { return getOrientation() * IDENTITY_UP; }
glm::vec3 getBodyFrontDirection() const { return getOrientation() * IDENTITY_FRONT; }
glm::quat computeRotationFromBodyToWorldUp(float proportion = 1.0f) const;
void updateCollisionWithSphere(glm::vec3 position, float radius, float deltaTime);
void updateBodyBalls(float deltaTime);
void updateArmIKAndConstraints(float deltaTime);
void setScale(const float scale);

View file

@ -193,11 +193,6 @@ void MyAvatar::simulate(float deltaTime, Transmitter* transmitter, float gyroCam
// update body balls
updateBodyBalls(deltaTime);
// test for avatar collision response with the big sphere
if (usingBigSphereCollisionTest && _isCollisionsOn) {
updateCollisionWithSphere(_TEST_bigSpherePosition, _TEST_bigSphereRadius, deltaTime);
}
// add thrust to velocity
_velocity += _thrust * deltaTime;
@ -421,16 +416,6 @@ static TextRenderer* textRenderer() {
}
void MyAvatar::render(bool lookingInMirror, bool renderAvatarBalls) {
if (usingBigSphereCollisionTest) {
// show TEST big sphere
glColor4f(0.5f, 0.6f, 0.8f, 0.7);
glPushMatrix();
glTranslatef(_TEST_bigSpherePosition.x, _TEST_bigSpherePosition.y, _TEST_bigSpherePosition.z);
glScalef(_TEST_bigSphereRadius, _TEST_bigSphereRadius, _TEST_bigSphereRadius);
glutSolidSphere(1, 20, 20);
glPopMatrix();
}
if (Application::getInstance()->getAvatar()->getHand().isRaveGloveActive()) {
_hand.setRaveLights(RAVE_LIGHTS_AVATAR);