| 95 | } |
| 96 | |
| 97 | bool ObjColSphere::IsHitCylinder(JGeometry::TVec3f posThis, JGeometry::TVec3f posOther, |
| 98 | const ObjColCylinder &cylinderCol) |
| 99 | { |
| 100 | bool isHit = false; |
| 101 | f32 sphereScaledRadius = mRadius * getScale(); |
| 102 | f32 deltaX, deltaZ, minSeparationSq, distanceSq; |
| 103 | if (cylinderCol.checkRadialCollisionXZ(sphereScaledRadius, posThis, posOther, |
| 104 | minSeparationSq, distanceSq, deltaX, deltaZ)) { |
| 105 | if ((posThis.y - sphereScaledRadius < posOther.y + cylinderCol.getScaledHeight()) && |
| 106 | (posThis.y + sphereScaledRadius > posOther.y)) { |
| 107 | f32 minSeparation = JMAFastSqrt(minSeparationSq); |
| 108 | f32 distance = JMAFastSqrt(distanceSq); |
| 109 | mBoundDepth = minSeparation - distance; |
| 110 | mPos.set(deltaX, 0.0f, deltaZ); |
| 111 | stVecNormalize(mPos); |
| 112 | isHit = true; |
| 113 | } |
| 114 | } |
| 115 | return isHit; |
| 116 | } |
| 117 | |
| 118 | bool ObjColCylinder::IsHitSphere(JGeometry::TVec3f posThis, JGeometry::TVec3f posOther, f32 otherRadius) |
| 119 | { |
no test coverage detected