MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / IsPointWithinRadius

Method IsPointWithinRadius

CrySystem/ScriptObjectEntity.cpp:2248–2275  ·  view source on GitHub ↗

! Determines whether a given point is within an entities radius @param Vector 3d representing a point in world space @return true or false @see CEntity::GetRadius */

Source from the content-addressed store, hash-verified

2246 @see CEntity::GetRadius
2247*/
2248int CScriptObjectEntity::IsPointWithinRadius(IFunctionHandler *pH)
2249{
2250 CHECK_PARAMETERS(1);
2251
2252 Vec3 vPosition;
2253
2254 // Get the passed position vector
2255 CScriptObjectVector oVec(m_pScriptSystem,true);
2256 pH->GetParam(1,*oVec);
2257 vPosition = oVec.Get();
2258
2259 // Sean, Nov 23
2260 // The players radius is far too large, like 5+ meters
2261 // So I am scaling it by 50% for now.
2262 // Talk to Petar about fixing player radius
2263// TRACE("Fix hack in CScriptObjectEntity::IsPointWithinRadius");
2264 float HackedValue = m_pEntity->GetRadius()*.5f;// / 2.0f;
2265// float HackedValue = m_pEntity->GetRadiusPhys()*.5f;// / 2.0f;
2266
2267 // Calculate the distance of this position from the player
2268 // If the distance is within the player's radius, return true
2269 // otherwise return false
2270
2271//Vec3 epos = m_pEntity->GetPos(false);
2272//float dst = vPosition.Distance(m_pEntity->GetPos(false));
2273 return pH->EndFunction( GetDistance(vPosition,m_pEntity->GetPos(false)) <= HackedValue);
2274
2275}
2276
2277/*! Determines distance between the entity and a given 3d point
2278 @param Vector 3d representing a point in world space

Callers

nothing calls this directly

Calls 5

EndFunctionMethod · 0.80
GetParamMethod · 0.45
GetMethod · 0.45
GetRadiusMethod · 0.45
GetPosMethod · 0.45

Tested by

no test coverage detected