Skip to content

Entity#

Defined in Entity.hpp. The Entity class wraps an index into the entity array and provides methods to query entity state.

Creating Entities#

LocalPlayer#

Entity LocalPlayer();

Returns the local player entity.

Entity me = LocalPlayer();
Vector3 myPos = me.GetPosition();

GetPlayer#

Entity GetPlayer(int index);

Returns the entity at the given index. Index range is 0 to GetPlayerCount() - 1.

GetPlayerCount#

int GetPlayerCount();

Returns the total number of entities in the array.

FindBestTarget#

Entity FindBestTarget(int flags);

Returns the best target entity based on the host's targeting logic. Pass 0 for default behavior.

Parameter Type Description
flags int Targeting flags (pass 0 for default)
Returns Description
Valid Entity A target was found
Invalid Entity No suitable target (check with IsValid() or operator bool())
Entity target = FindBestTarget(0);
if (target)
{
    Vector2 screen;
    if (WorldToScreen(target.GetBonePos(Bone::Head), screen))
        Draw::CircleFilled(screen, 8.f, Color::Red());
}

FindBestTargetInFov#

Entity FindBestTargetInFov(float fovRadius, int boneId, int flags);

Returns the best target within a screen-space FOV radius, closest to the crosshair.

Parameter Type Description
fovRadius float Maximum pixel distance from crosshair
boneId int Bone to measure against (see Bone constants)
flags int TargetFlags bitmask
Entity target = FindBestTargetInFov(100.f, Bone::Head, TargetFlags::Enemy | TargetFlags::Visible);
if (target)
{
    Vector2 screen;
    if (WorldToScreen(target.GetBonePos(Bone::Head), screen))
        Draw::CircleFilled(screen, 8.f, Color::Red());
}

CalcAngle#

Vector3 CalcAngle(const Vector3& from, const Vector3& to);

Calculates the angle (pitch, yaw, 0) in radians from one position to another.

GetHeroName#

const char* GetHeroName(uint64_t heroId);

Returns a human-readable hero name string for a hero pool ID. Returns "Unknown" for unrecognized IDs.

const char* name = GetHeroName(entity.GetHeroId());
// "Widowmaker", "Tracer", etc.

Entity Class#

Validity#

IsValid#

bool IsValid() const;

Returns true if the entity is valid (has a valid index and is alive or has health).

operator bool#

explicit operator bool() const;

Same as IsValid(). Allows if (entity) { ... }.

Index#

int32_t Index() const;

Returns the entity's index in the entity array.


Identity#

GetHeroId#

uint64_t GetHeroId() const;

Returns the hero pool ID. Compare with HeroId constants.

if (entity.GetHeroId() == HeroId::Widowmaker)
    Log("It's Widowmaker");

GetEntityType#

EntityType GetEntityType() const;

Returns the entity type (Hero, Turret, Bot, etc.).

GetTeam#

Team GetTeam() const;

Returns the entity's team.


State#

IsAlive#

bool IsAlive() const;

Returns true if the entity is alive.

IsLocal#

bool IsLocal() const;

Returns true if this is the local player.

IsVisible#

bool IsVisible() const;

Returns true if the entity is currently visible (not behind a wall).

IsInvulnerable#

bool IsInvulnerable() const;

Returns true if the entity is invulnerable.

IsEnemy#

bool IsEnemy() const;

Returns true if the entity is on a different team than the local player and is not the local player.

IsAlly#

bool IsAlly() const;

Returns true if the entity is on the same team as the local player.


Abilities#

GetUltCharge#

float GetUltCharge() const;

Returns the entity's ultimate charge percentage (0–100). Only populated for the local player.

IsUltActive#

bool IsUltActive() const;

Returns true if the entity's ultimate is currently active.

IsSkill1Active#

bool IsSkill1Active() const;

Returns true if the entity's Skill 1 (Shift) is currently active.

IsSkill2Active#

bool IsSkill2Active() const;

Returns true if the entity's Skill 2 (E) is currently active.

IsSkill3Active#

bool IsSkill3Active() const;

Returns true if the entity's Skill E / ultimate ability is currently active.

Entity me = LocalPlayer();
if (me.GetUltCharge() >= 100.f)
    Log("Ult ready!");

for (Entity player : Players())
{
    if (player.IsUltActive())
        Log("Someone is ulting!");
}

Health#

GetHealth#

float GetHealth() const;

Returns current health (total HP including all pools).

GetTotalHealth#

float GetTotalHealth() const;

Alias for GetHealth(). Returns total HP.

GetHealthMax#

float GetHealthMax() const;

Returns maximum health.

GetHealthPercent#

float GetHealthPercent() const;

Returns health as a percentage (0-100).

IsFullHealth#

bool IsFullHealth() const;

Returns true if current health >= max health.

GetOverhealth#

float GetOverhealth() const;

Returns the entity's current overhealth amount (temporary bonus HP from abilities like Lucio ult).

GetArmor#

float GetArmor() const;

Returns current armor.

GetBarrier#

float GetBarrier() const;

Returns current barrier (shield HP).

float hp = enemy.GetHealthPercent();
Draw::HealthBar(x, y, 50, 4, hp);

Forward Vector#

GetForward#

Vector3 GetForward() const;

Returns the entity's forward-facing direction as a unit vector.

Vector3 fwd = enemy.GetForward();
// Draw a "facing" indicator
Vector3 endPos = enemy.GetPosition() + fwd * 3.0f;

Targeting / State#

IsTargetable#

bool IsTargetable() const;

Returns true if the entity can be targeted. Entities that are invulnerable, phased (Moira fade, Reaper wraith), or otherwise untargetable return false.

IsReloading#

bool IsReloading() const;

Returns true if the entity is currently in a reload animation.


Hitboxes#

GetHitboxCount#

int GetHitboxCount() const;

Returns the number of hitboxes for this entity.

GetHitbox#

bool GetHitbox(int index, Hitbox& out) const;

Retrieves a single hitbox by index. Returns true on success.

Parameter Type Description
index int Hitbox index (0 to GetHitboxCount() - 1)
out Hitbox& Output hitbox data

GetHitboxes#

int GetHitboxes(Hitbox* out, int maxCount) const;

Copies all hitboxes into out. Returns the number of hitboxes written (capped at maxCount).

Parameter Type Description
out Hitbox* Output array
maxCount int Maximum entries to write
Hitbox hitboxes[32];
int count = enemy.GetHitboxes(hitboxes, 32);
for (int i = 0; i < count; ++i)
{
    Vector2 screen;
    if (WorldToScreen(hitboxes[i].worldPos, screen))
        Draw::CircleFilled(screen, hitboxes[i].radius * 10.f, Color::Yellow());
}

Hitbox Struct#

struct Hitbox
{
    uint16_t boneIndex;    // Physical bone index this hitbox is attached to
    float radius;          // Hitbox radius (sphere or capsule radius)
    int8_t bodySlot;       // BodySlot classification (-1 = unclassified)
    uint8_t isCapsule;     // 1 if capsule, 0 if sphere
    Vector3 worldPos;      // World-space position (sphere center / capsule start)
    Vector3 capsuleEnd;    // World-space capsule endpoint (only valid if isCapsule)
};

See BodySlot constants for body region classification.


Lerp History#

GetLerpHistory#

int GetLerpHistory(LerpEntry* out, int maxCount) const;

Copies the entity's server tick position history into out. Entries are sorted newest-first. Returns the number of entries written (capped at maxCount).

Parameter Type Description
out LerpEntry* Output array
maxCount int Maximum entries to write
LerpEntry history[20];
int count = enemy.GetLerpHistory(history, 20);
for (int i = 1; i < count; ++i)
{
    Vector2 a, b;
    if (WorldToScreen(history[i-1].position, a) &&
        WorldToScreen(history[i].position, b))
        Draw::Line(a, b, Color::Cyan(), 1.f);
}

LerpEntry Struct#

struct LerpEntry
{
    int32_t tick;       // Server tick number
    Vector3 position;   // Entity position at that tick
};

Position#

GetPosition#

Vector3 GetPosition() const;

Returns the entity's root (feet) position.

GetBonePos#

Vector3 GetBonePos(int boneId) const;

Returns the position of a specific bone. See Bone constants.

Vector3 hand = entity.GetBonePos(Bone::RHand);

GetBoundsMin#

Vector3 GetBoundsMin() const;

Returns the AABB minimum in local space. Alias for GetDelta1().

GetBoundsMax#

Vector3 GetBoundsMax() const;

Returns the AABB maximum in local space. Alias for GetDelta2().

GetNametagYPos#

float GetNametagYPos() const;

Returns the Y position offset for the entity's nametag.

GetDistance#

float GetDistance() const;

Returns the distance from the local player to this entity.

GetFovTo#

float GetFovTo(int boneId) const;

Returns the FOV distance in pixels from the screen crosshair to the specified bone.

Parameter Type Description
boneId int Bone ID (see Bone constants)
float fov = entity.GetFovTo(Bone::Head);

GetScreenOffsetTo#

Vector2 GetScreenOffsetTo(int boneId) const;

Returns the 2D screen offset from the crosshair to the specified bone.

PredictPosition#

Vector3 PredictPosition(float time) const;

Predicts the entity's position after time seconds using its current velocity.

Parameter Type Description
time float Time in seconds to predict ahead
Vector3 futurePos = entity.PredictPosition(0.1f);

GetClosestBoneInFov#

int GetClosestBoneInFov(float fovRadius) const;

Returns the bone ID closest to the crosshair within the given FOV radius (in pixels). Returns -1 if no bone is within range.

Parameter Type Description
fovRadius float Maximum pixel distance from crosshair

GetAngleFrom#

Vector3 GetAngleFrom(const Vector3& src) const;

Calculates the angle (pitch, yaw, 0) from src to this entity's position.


Outline / Glow#

SetOutline#

void SetOutline(int outlineType, Color color) const;

Applies an outline to the entity.

Parameter Type Description
outlineType int 1 = visible, 2 = occluded (through walls). See OutlineType.
color Color Outline color

SetOutlineVisible#

void SetOutlineVisible(Color color) const;

Shorthand for SetOutline(1, color). Outline when entity is in line of sight.

SetOutlineOccluded#

void SetOutlineOccluded(Color color) const;

Shorthand for SetOutline(2, color). Outline when entity is behind walls.

// Wallhack outline on enemies
for (Entity player : Players())
{
    if (!player.IsAlive() || !player.IsEnemy()) continue;
    player.SetOutlineOccluded(Color::Red());
}

Skeleton#

BonePair#

struct BonePair { int a; int b; };

A pair of bone IDs representing one connection in a skeleton.

GetSkeletonConnections#

int GetSkeletonConnections(uint64_t heroId, BonePair* out);

Fills out with the bone connections for the given hero and returns the number of pairs written. The host handles hero-specific remapping (Bastion, Mei, Reaper, Torbjorn, etc.) automatically.

Parameter Type Description
heroId uint64_t Hero pool ID (from Entity::GetHeroId())
out BonePair* Output array — must hold at least 21 entries
Returns Description
int Number of bone pairs written (currently always 21)
BonePair bones[21];
int count = GetSkeletonConnections(enemy.GetHeroId(), bones);

for (int i = 0; i < count; ++i)
{
    Vector2 a, b;
    if (WorldToScreen(enemy.GetBonePos(bones[i].a), a) &&
        WorldToScreen(enemy.GetBonePos(bones[i].b), b))
    {
        Draw::Line(a, b, Color::White(), 1.5f);
    }
}

Weapon Info#

WeaponInfo Struct#

struct WeaponInfo
{
    uint8_t valid;           // 1 if the hero has a weapon for this input
    uint8_t useable;         // 1 if weapon is ready (charge met, not on cooldown)
    uint8_t shootable;       // 1 if not reloading or ability-blocked
    uint8_t hasGravity;      // 1 if projectile is affected by gravity (arc)
    float projectileSpeed;   // m/s, 0 = hitscan
    float maxRange;          // hard max range in meters, 0 = unlimited
    uint8_t reloading;       // 1 if currently in reload animation
    uint8_t skillBlocked;    // 1 if ability animation is preventing fire
};

GetWeaponInfo#

bool GetWeaponInfo(int32_t inputFlags, WeaponInfo& out);

Queries weapon info for the local player's current hero. Returns true if the input flag is valid.

Parameter Type Description
inputFlags int32_t Which fire mode to query (see InputFlag constants)
out WeaponInfo& Output struct filled with weapon state

InputFlag Constants#

Constant Value Description
InputFlag::PrimaryFire 0x0001 Left mouse / primary weapon
InputFlag::SecondaryFire 0x0002 Right mouse / alt fire
InputFlag::ScopedShoot 0x0003 Scoped fire (Ana, Ashe, Widowmaker)
InputFlag::Skill1 0x0008 Ability 1 (e.g. Ana Sleep Dart)
InputFlag::Skill2 0x0010 Ability 2 (e.g. Ana Biotic Grenade)
InputFlag::Ultimate 0x0020 Ultimate ability
InputFlag::PrimaryRelease 0x1000 Primary fire release (Hanzo bow)
// Check if primary fire is ready and get projectile speed
WeaponInfo wi;
if (GetWeaponInfo(InputFlag::PrimaryFire, wi) && wi.valid)
{
    if (wi.projectileSpeed > 0.f)
        Log("Projectile weapon");
    else
        Log("Hitscan weapon");

    if (wi.useable && wi.shootable)
        Log("Weapon ready to fire");
}

// Check multiple fire modes
WeaponInfo primary, alt;
GetWeaponInfo(InputFlag::PrimaryFire, primary);
GetWeaponInfo(InputFlag::SecondaryFire, alt);

Iterators#

Players#

PlayerRange Players();

Returns a range over all entities. Use with range-based for loops.

for (Entity player : Players())
{
    if (player.IsLocal()) continue;
    // ...
}

PluginEntity Struct#

The raw data struct copied from the host. You normally don't use this directly — use the Entity class instead. See PluginEntity Layout for byte offsets.

#pragma pack(push, 1)
struct PluginEntity
{
    uint32_t id;
    uint64_t heroId;
    uint32_t entityType;
    uint32_t team;
    Vector3 position;
    Vector3 velocity;
    Vector3 rotation;
    float health;
    float maxHealth;
    float armor;
    float barrier;
    uint8_t alive;
    uint8_t visible;
    uint8_t isLocalPlayer;
    uint8_t isInvulnerable;
    float ultCharge;    // Ult charge % (0-100), local player only
    uint8_t ultActive;  // 1 if ult is active
    Vector2 skill1Active;  // .x = 1.0 if Skill 1 (Shift) active, 0.0 otherwise
    Vector2 skill2Active;  // .x = 1.0 if Skill 2 (E) active, 0.0 otherwise
    Vector2 skill3Active;  // .x = 1.0 if Skill 3 active, 0.0 otherwise
    Vector3 delta1;     // AABB min (local space)
    Vector3 delta2;     // AABB max (local space)
    float nametagYPos;
    float overhealth;   // Current overhealth amount
    uint8_t hitboxCount;  // Number of hitboxes
    uint8_t isTargetable; // 1 if entity can be targeted
    uint8_t isReloading;  // 1 if currently reloading
    uint8_t _pad0;
    Vector3 forward;    // Entity forward direction
};
#pragma pack(pop)