MCPcopy Create free account
hub / github.com/doldecomp/mkdd / IsHitCylinder

Method IsHitCylinder

src/Sato/ObjCollision.cpp:97–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97bool 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
118bool ObjColCylinder::IsHitSphere(JGeometry::TVec3f posThis, JGeometry::TVec3f posOther, f32 otherRadius)
119{

Callers 1

IsHitObjectMethod · 0.80

Calls 8

JMAFastSqrtFunction · 0.85
stVecNormalizeFunction · 0.85
getScaledHeightMethod · 0.80
getCylinderHeightMethod · 0.80
getCylinderRadiusMethod · 0.80
setMethod · 0.45
getScaleMethod · 0.45

Tested by

no test coverage detected