MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / getProximity

Method getProximity

src/clientbase/World.cpp:386–412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384
385
386float World::getProximity(const fvec3& p, float radius) const {
387 const float r = (radius * 1.2f);
388
389 // get maximum over all teleporters
390 float bestProximity = 0.0;
391
392 const Extents exts(fvec3(p.x - r, p.y - r, p.z - r),
393 fvec3(p.x + r, p.y + r, p.z + r));
394 const ObsList* oList = COLLISIONMGR.axisBoxTest(exts);
395 const int count = oList->count;
396
397 for (int i = 0; i < count; i++) {
398 const Obstacle* obs = oList->list[i];
399 if (obs->getTypeID() == faceType) {
400 const MeshFace* face = (const MeshFace*)obs;
401 if (face->isLinkSrc() && !face->linkSrcNoGlow() &&
402 (face->isDriveThrough() || face->linkSrcTouch())) {
403 const float proximity = face->getProximity(p, r);
404 if (proximity > bestProximity) {
405 bestProximity = proximity;
406 }
407 }
408 }
409 }
410
411 return bestProximity;
412}
413
414
415void World::freeFlags() {

Callers 2

moveMethod · 0.45
updateTranslucencyMethod · 0.45

Calls 6

axisBoxTestMethod · 0.80
isLinkSrcMethod · 0.80
linkSrcNoGlowMethod · 0.80
isDriveThroughMethod · 0.80
linkSrcTouchMethod · 0.80
getTypeIDMethod · 0.45

Tested by

no test coverage detected