MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / hit_test

Method hit_test

src/SB/Game/zEntCruiseBubble.cpp:3129–3155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3127 }
3128
3129 U8 cruise_bubble::state_missle_fly::hit_test(xVec3& hit_loc, xVec3& hit_norm,
3130 xVec3& hit_depen, xEnt*& hit_ent) const
3131 {
3132 xScene* s = globals.sceneCur;
3133 xVec3* loc = &get_missle_mat()->pos;
3134 xSweptSphere ss;
3135 xSweptSpherePrepare(&ss, (xVec3*)&this->last_loc, loc, current_tweak->missle.hit_dist);
3136 ss.optr = NULL;
3137 if (!xSweptSphereToScene(&ss, s, NULL, 0x10))
3138 {
3139 return false;
3140 }
3141
3142 xSweptSphereGetResults(&ss);
3143 // scheduling off
3144 xVec3 overshoot = {};
3145 overshoot.x = loc->x - ss.worldPos.x;
3146 overshoot.y = loc->y - ss.worldPos.y;
3147 overshoot.z = loc->z - ss.worldPos.z;
3148 // till here
3149 hit_loc = ss.worldPos + ss.worldTangent * overshoot.dot(ss.worldTangent);
3150 hit_depen = hit_loc - *loc;
3151 hit_norm = ss.worldNormal;
3152 hit_ent = (xEnt*)ss.optr;
3153
3154 return true;
3155 }
3156
3157 void cruise_bubble::state_missle_fly::update_move(F32 dt)
3158 {

Callers 1

collideMethod · 0.95

Calls 5

get_missle_matFunction · 0.85
xSweptSphereGetResultsFunction · 0.85
xSweptSpherePrepareFunction · 0.50
xSweptSphereToSceneFunction · 0.50
dotMethod · 0.45

Tested by

no test coverage detected