Showing the changes to interface/src/avatar/MyCharacterController.cpp (1 of 1 file). Show all
Unified · Split
| @@ -149,11 +149,11 @@ bool MyCharacterController::testRayShotgun(const glm::vec3& position, const glm: · 148 unmodified lines | |||
| 149 | if (!result.walkable) { | 149 | if (!result.walkable) { |
| 150 | // the top scan wasn't walkable so don't bother scanning the bottom | 150 | // the top scan wasn't walkable so don't bother scanning the bottom |
| 151 | // remove both forwardSlop and backSlop | 151 | // remove both forwardSlop and backSlop |
| 152 | result.hitFraction = (closestRayResult.m_closestHitFraction * (backSlop + stepLength + forwardSlop) - forwardSlop) / (backSlop + stepLength); | 152 | result.hitFraction = glm::min(1.0f, (closestRayResult.m_closestHitFraction * (backSlop + stepLength + forwardSlop) - backSlop) / stepLength); |
| 153 | } else { | 153 | } else { |
| 154 | if (needToRemoveForwardSlop && result.hitFraction < 1.0f) { | 154 | if (needToRemoveForwardSlop && result.hitFraction < 1.0f) { |
| 155 | // remove forwardSlop | 155 | // remove forwardSlop |
| 156 | result.hitFraction = (closestRayResult.m_closestHitFraction * (stepLength + forwardSlop) - forwardSlop) / stepLength; | 156 | result.hitFraction = (closestRayResult.m_closestHitFraction * (backSlop + stepLength + forwardSlop)) / (backSlop + stepLength); |
| 157 | } | 157 | } |
| 158 | // scan the bottom | 158 | // scan the bottom |
| 159 | for (int32_t i = 0; i < _bottomPoints.size(); ++i) { | 159 | for (int32_t i = 0; i < _bottomPoints.size(); ++i) { |
| @@ -168,7 +168,7 @@ bool MyCharacterController::testRayShotgun(const glm::vec3& position, const glm: · 8 unmodified lines | |||
| 168 | // remove backSlop | 168 | // remove backSlop |
| 169 | // NOTE: backSlop removal can produce a NEGATIVE hitFraction! | 169 | // NOTE: backSlop removal can produce a NEGATIVE hitFraction! |
| 170 | // which means the shape is actually in interpenetration | 170 | // which means the shape is actually in interpenetration |
| 171 | result.hitFraction = (closestRayResult.m_closestHitFraction * (backSlop + stepLength) - backSlop) / stepLength; | 171 | result.hitFraction = ((closestRayResult.m_closestHitFraction * (backSlop + stepLength)) - backSlop) / stepLength; |
| 172 | } | 172 | } |
| 173 | return result.hitFraction < 1.0f; | 173 | return result.hitFraction < 1.0f; |
| 174 | } | 174 | } |