实体

世界 CWorld

贴地、射线、区域清理与爆炸

CWorld.h

贴地高度

FindGroundZForCoord / FindRoofZFor3DCoord
static float FindGroundZForCoord(float x, float y);
static float FindGroundZFor3DCoord(float x, float y, float z, bool* outResult, CEntity** outEntity);
static float FindRoofZFor3DCoord(float x, float y, float z, bool* outResult);
static float FindLowestZForCoord(float x, float y);

视线是否畅通

GetIsLineOfSightClear
static bool GetIsLineOfSightClear(
    CVector const& origin, CVector const& target,
    bool buildings, bool vehicles, bool peds, bool objects, bool dummies,
    bool doSeeThroughCheck, bool doCameraIgnoreCheck);

射线检测

ProcessLineOfSight / ProcessVerticalLine

写出碰撞点。

static bool ProcessLineOfSight(... CColPoint& outColPoint, CEntity*& outEntity, ...);
static bool ProcessVerticalLine(CVector const& origin, float distance, CColPoint& outColPoint, CEntity*& outEntity, ...);

半径内找实体

FindObjectsInRange

计数 + 缓冲。

static void FindObjectsInRange(
    CVector const& point, float radius, bool b2D,
    short* outCount, short maxCount, CEntity** outEntities,
    bool buildings, bool vehicles, bool peds, bool objects, bool dummies);

清空区域实体

ClearPedsFromArea / ClearCarsFromArea
static void ClearPedsFromArea(float x1, float y1, float z1, float x2, float y2, float z2);
static void ClearCarsFromArea(float x1, float y1, float z1, float x2, float y2, float z2);

爆炸与着火

TriggerExplosion / SetWorldOnFire
static void TriggerExplosion(CVector const& point, float radius, float visibleDistance,
    CEntity* victim, CEntity* creator, bool processVehicleBombTimer, float damage);
static void SetWorldOnFire(float x, float y, float z, float radius, CEntity* fireCreator);

实体进出世界

Add / Remove

自己 new 的才需要。

static void Add(CEntity* entity);
static void Remove(CEntity* entity);

灭区域车火

ExtinguishAllCarFiresInArea / SetAllCarsCanBeDamaged
static void ExtinguishAllCarFiresInArea(CVector point, float radius);
static void SetAllCarsCanBeDamaged(bool enable);

区域清热闹内容

ClearExcitingStuffFromArea

含可选弹道阴影。

static void ClearExcitingStuffFromArea(CVector const& point, float radius, unsigned char bRemoveProjectilesAndShadows);

球测碰撞

TestSphereAgainstWorld

返回命中实体。

static CEntity* TestSphereAgainstWorld(CVector sphereCenter, float sphereRadius, CEntity* arg2,
    bool buildings, bool vehicles, bool peds, bool objects, bool dummies, bool doCameraIgnoreCheck);

On this page