! 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 */
| 2246 | @see CEntity::GetRadius |
| 2247 | */ |
| 2248 | int 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 |
nothing calls this directly
no test coverage detected