diff --git a/audio-mixer/src/InjectedAudioRingBuffer.cpp b/audio-mixer/src/InjectedAudioRingBuffer.cpp index bb890caeb1..426bbf361d 100644 --- a/audio-mixer/src/InjectedAudioRingBuffer.cpp +++ b/audio-mixer/src/InjectedAudioRingBuffer.cpp @@ -40,4 +40,4 @@ int InjectedAudioRingBuffer::parseData(unsigned char* sourceBuffer, int numBytes currentBuffer += parseAudioSamples(currentBuffer, numBytes - (currentBuffer - sourceBuffer)); return currentBuffer - sourceBuffer; -} \ No newline at end of file +} diff --git a/audio-mixer/src/PositionalAudioRingBuffer.cpp b/audio-mixer/src/PositionalAudioRingBuffer.cpp index a518e1534c..83626a3a29 100644 --- a/audio-mixer/src/PositionalAudioRingBuffer.cpp +++ b/audio-mixer/src/PositionalAudioRingBuffer.cpp @@ -65,4 +65,4 @@ bool PositionalAudioRingBuffer::shouldBeAddedToMix(int numJitterBufferSamples) { } return false; -} \ No newline at end of file +} diff --git a/interface/src/Avatar.cpp b/interface/src/Avatar.cpp index 76831605b4..c0be97aebb 100644 --- a/interface/src/Avatar.cpp +++ b/interface/src/Avatar.cpp @@ -806,13 +806,12 @@ void Avatar::applyCollisionWithScene(const glm::vec3& penetration) { static float STATIC_FRICTION_VELOCITY = 0.15f; static float STATIC_FRICTION_DAMPING = 0.0f; static float KINETIC_FRICTION_DAMPING = 0.95f; - const float BOUNCE = 0.3f; - // reflect the velocity component in the direction of penetration + // cancel out the velocity component in the direction of penetration float penetrationLength = glm::length(penetration); if (penetrationLength > EPSILON) { glm::vec3 direction = penetration / penetrationLength; - _velocity -= 2.0f * glm::dot(_velocity, direction) * direction * BOUNCE; + _velocity -= glm::dot(_velocity, direction) * direction; _velocity *= KINETIC_FRICTION_DAMPING; // If velocity is quite low, apply static friction that takes away energy if (glm::length(_velocity) < STATIC_FRICTION_VELOCITY) { @@ -1008,7 +1007,6 @@ void Avatar::updateBodyBalls(float deltaTime) { resetBodyBalls(); } glm::quat orientation = getOrientation(); - glm::vec3 jointDirection = orientation * JOINT_DIRECTION; for (int b = 0; b < NUM_AVATAR_BODY_BALLS; b++) { glm::vec3 springVector; @@ -1068,11 +1066,18 @@ void Avatar::updateBodyBalls(float deltaTime) { if (_skeleton.joint[b].parent == AVATAR_JOINT_NULL || length < SMALL_SPRING_LENGTH) { _bodyBall[b].rotation = orientation * _skeleton.joint[_bodyBall[b].parentJoint].absoluteBindPoseRotation; } else { - glm::vec3 parentDirection = _bodyBall[ _skeleton.joint[b].parent ].rotation * JOINT_DIRECTION; + glm::vec3 parentDirection = _bodyBall[ _bodyBall[b].parentBall ].rotation * JOINT_DIRECTION; _bodyBall[b].rotation = rotationBetween(parentDirection, springVector) * - _bodyBall[ _skeleton.joint[b].parent ].rotation; + _bodyBall[ _bodyBall[b].parentBall ].rotation; } } + + // copy the head's rotation + _bodyBall[BODY_BALL_HEAD_BASE].rotation = _bodyBall[BODY_BALL_HEAD_TOP].rotation = _head.getOrientation(); + _bodyBall[BODY_BALL_HEAD_BASE].position = _bodyBall[BODY_BALL_NECK_BASE].position + + _bodyBall[BODY_BALL_HEAD_BASE].rotation * _skeleton.joint[BODY_BALL_HEAD_BASE].bindPosePosition; + _bodyBall[BODY_BALL_HEAD_TOP].position = _bodyBall[BODY_BALL_HEAD_BASE].position + + _bodyBall[BODY_BALL_HEAD_TOP].rotation * _skeleton.joint[BODY_BALL_HEAD_TOP].bindPosePosition; } void Avatar::updateArmIKAndConstraints(float deltaTime) { @@ -1133,7 +1138,7 @@ void Avatar::renderBody(bool lookingInMirror, bool renderAvatarBalls) { const float RENDER_TRANSLUCENT_BEYOND = 0.5f; // Render the body as balls and cones - if (renderAvatarBalls) { + if (renderAvatarBalls || !_voxels.getVoxelURL().isValid()) { for (int b = 0; b < NUM_AVATAR_BODY_BALLS; b++) { float distanceToCamera = glm::length(_cameraPosition - _bodyBall[b].position); diff --git a/interface/src/Skeleton.cpp b/interface/src/Skeleton.cpp index 92dba252a1..2fa43c9010 100644 --- a/interface/src/Skeleton.cpp +++ b/interface/src/Skeleton.cpp @@ -56,6 +56,7 @@ void Skeleton::initialize() { joint[ AVATAR_JOINT_CHEST ].bindPosePosition = glm::vec3( 0.0, 0.09, -0.01 ); joint[ AVATAR_JOINT_NECK_BASE ].bindPosePosition = glm::vec3( 0.0, 0.14, 0.01 ); joint[ AVATAR_JOINT_HEAD_BASE ].bindPosePosition = glm::vec3( 0.0, 0.04, 0.00 ); + joint[ AVATAR_JOINT_HEAD_TOP ].bindPosePosition = glm::vec3( 0.0, 0.04, 0.00 ); joint[ AVATAR_JOINT_LEFT_COLLAR ].bindPosePosition = glm::vec3( -0.06, 0.04, 0.01 ); joint[ AVATAR_JOINT_LEFT_SHOULDER ].bindPosePosition = glm::vec3( -0.05, 0.0, 0.01 ); @@ -85,6 +86,7 @@ void Skeleton::initialize() { joint[ AVATAR_JOINT_CHEST ].defaultPosePosition = glm::vec3( 0.0, 0.09, -0.01 ); joint[ AVATAR_JOINT_NECK_BASE ].defaultPosePosition = glm::vec3( 0.0, 0.14, 0.01 ); joint[ AVATAR_JOINT_HEAD_BASE ].defaultPosePosition = glm::vec3( 0.0, 0.04, 0.00 ); + joint[ AVATAR_JOINT_HEAD_TOP ].defaultPosePosition = glm::vec3( 0.0, 0.04, 0.00 ); joint[ AVATAR_JOINT_LEFT_COLLAR ].defaultPosePosition = glm::vec3( -0.06, 0.04, 0.01 ); joint[ AVATAR_JOINT_LEFT_SHOULDER ].defaultPosePosition = glm::vec3( -0.05, 0.0, 0.01 ); diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 7e179c0919..9cde8906be 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -256,7 +256,6 @@ void VoxelSystem::copyWrittenDataToReadArraysFullVBOs() { void VoxelSystem::copyWrittenDataToReadArraysPartialVBOs() { glBufferIndex segmentStart = 0; - glBufferIndex segmentEnd = 0; bool inSegment = false; for (glBufferIndex i = 0; i < _voxelsInWriteArrays; i++) { bool thisVoxelDirty = _writeVoxelDirtyArray[i]; @@ -560,7 +559,6 @@ void VoxelSystem::updateFullVBOs() { void VoxelSystem::updatePartialVBOs() { glBufferIndex segmentStart = 0; - glBufferIndex segmentEnd = 0; bool inSegment = false; for (glBufferIndex i = 0; i < _voxelsInReadArrays; i++) { bool thisVoxelDirty = _readVoxelDirtyArray[i];