fixed mohawk physics bug

This commit is contained in:
Jeffrey Ventrella 2013-08-07 10:17:53 -07:00
parent f9f925b70b
commit 253154ce6d
4 changed files with 14 additions and 10 deletions

View file

@ -2681,7 +2681,7 @@ void Application::updateAvatar(float deltaTime) {
// If I'm in paint mode, send a voxel out to VOXEL server nodes.
if (_paintOn) {
glm::vec3 avatarPos = _myAvatar.getPosition();
// For some reason, we don't want to flip X and Z here.
@ -2692,7 +2692,7 @@ void Application::updateAvatar(float deltaTime) {
if (_paintingVoxel.x >= 0.0 && _paintingVoxel.x <= 1.0 &&
_paintingVoxel.y >= 0.0 && _paintingVoxel.y <= 1.0 &&
_paintingVoxel.z >= 0.0 && _paintingVoxel.z <= 1.0) {
PACKET_TYPE message = (_destructiveAddVoxel->isChecked() ?
PACKET_TYPE_SET_VOXEL_DESTRUCTIVE : PACKET_TYPE_SET_VOXEL);
sendVoxelEditMessage(message, _paintingVoxel);

View file

@ -24,7 +24,7 @@ BendyLine::BendyLine(){
_gravityForce = glm::vec3(0.0f, 0.0f, 0.0f);
_basePosition = glm::vec3(0.0f, 0.0f, 0.0f);
_baseDirection = glm::vec3(0.0f, 0.0f, 0.0f);
_baseDirection = glm::vec3(0.0f, 1.0f, 0.0f);
_midPosition = glm::vec3(0.0f, 0.0f, 0.0f);
_endPosition = glm::vec3(0.0f, 0.0f, 0.0f);
_midVelocity = glm::vec3(0.0f, 0.0f, 0.0f);

View file

@ -30,10 +30,12 @@ const float MINIMUM_EYE_ROTATION_DOT = 0.5f; // based on a dot product: 1.0 is
const float EYEBALL_RADIUS = 0.017;
const float EYELID_RADIUS = 0.019;
const float EYEBALL_COLOR[3] = { 0.9f, 0.9f, 0.8f };
const float HAIR_SPRING_FORCE = 7.0f;
const float HAIR_TORQUE_FORCE = 0.1f;
const float HAIR_GRAVITY_FORCE = 0.02f;
const float HAIR_SPRING_FORCE = 15.0f;
const float HAIR_TORQUE_FORCE = 0.2f;
const float HAIR_GRAVITY_FORCE = 0.001f;
const float HAIR_DRAG = 10.0f;
const float HAIR_LENGTH = 0.09f;
const float HAIR_THICKNESS = 0.03f;
const float NOSE_LENGTH = 0.025;
@ -73,9 +75,10 @@ Head::Head(Avatar* owningAvatar) :
_audioAttack(0.0f),
_returnSpringScale(1.0f),
_bodyRotation(0.0f, 0.0f, 0.0f),
_hairInitialized(false),
_renderLookatVectors(false),
_mohawkTriangleFan(NULL),
_mohawkColors(NULL),
_mohawkColors(NULL),
_saccade(0.0f, 0.0f, 0.0f),
_saccadeTarget(0.0f, 0.0f, 0.0f),
_leftEyeBlink(0.0f),
@ -128,7 +131,6 @@ void Head::reset() {
}
void Head::resetHairPhysics() {
//glm::vec3 up = getUpDirection();
for (int t = 0; t < NUM_HAIR_TUFTS; t ++) {
for (int t = 0; t < NUM_HAIR_TUFTS; t ++) {
@ -334,7 +336,7 @@ void Head::setScale (float scale) {
delete[] _mohawkColors;
createMohawk();
resetHairPhysics();
//resetHairPhysics();
}
void Head::createMohawk() {
@ -737,6 +739,7 @@ void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosi
}
void Head::updateHairPhysics(float deltaTime) {
glm::quat orientation = getOrientation();
glm::vec3 up = orientation * IDENTITY_UP;
glm::vec3 front = orientation * IDENTITY_FRONT;

View file

@ -112,7 +112,8 @@ private:
float _returnSpringScale; //strength of return springs
glm::vec3 _bodyRotation;
bool _renderLookatVectors;
BendyLine _hairTuft[NUM_HAIR_TUFTS];
BendyLine _hairTuft[NUM_HAIR_TUFTS];
bool _hairInitialized;
glm::vec3* _mohawkTriangleFan;
glm::vec3* _mohawkColors;
glm::vec3 _saccade;