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#
Returns the local player entity.
GetPlayer#
Returns the entity at the given index. Index range is 0 to GetPlayerCount() - 1.
GetPlayerCount#
Returns the total number of entities in the array.
FindBestTarget#
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#
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#
Calculates the angle (pitch, yaw, 0) in radians from one position to another.
GetHeroName#
Returns a human-readable hero name string for a hero pool ID. Returns "Unknown" for unrecognized IDs.
Entity Class#
Validity#
IsValid#
Returns true if the entity is valid (has a valid index and is alive or has health).
operator bool#
Same as IsValid(). Allows if (entity) { ... }.
Index#
Returns the entity's index in the entity array.
Identity#
GetHeroId#
Returns the hero pool ID. Compare with HeroId constants.
GetEntityType#
Returns the entity type (Hero, Turret, Bot, etc.).
GetTeam#
Returns the entity's team.
State#
IsAlive#
Returns true if the entity is alive.
IsLocal#
Returns true if this is the local player.
IsVisible#
Returns true if the entity is currently visible (not behind a wall).
IsInvulnerable#
Returns true if the entity is invulnerable.
IsEnemy#
Returns true if the entity is on a different team than the local player and is not the local player.
IsAlly#
Returns true if the entity is on the same team as the local player.
Abilities#
GetUltCharge#
Returns the entity's ultimate charge percentage (0–100). Only populated for the local player.
IsUltActive#
Returns true if the entity's ultimate is currently active.
IsSkill1Active#
Returns true if the entity's Skill 1 (Shift) is currently active.
IsSkill2Active#
Returns true if the entity's Skill 2 (E) is currently active.
IsSkill3Active#
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#
Returns current health (total HP including all pools).
GetTotalHealth#
Alias for GetHealth(). Returns total HP.
GetHealthMax#
Returns maximum health.
GetHealthPercent#
Returns health as a percentage (0-100).
IsFullHealth#
Returns true if current health >= max health.
GetOverhealth#
Returns the entity's current overhealth amount (temporary bonus HP from abilities like Lucio ult).
GetArmor#
Returns current armor.
GetBarrier#
Returns current barrier (shield HP).
Forward Vector#
GetForward#
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#
Returns true if the entity can be targeted. Entities that are invulnerable, phased (Moira fade, Reaper wraith), or otherwise untargetable return false.
IsReloading#
Returns true if the entity is currently in a reload animation.
Hitboxes#
GetHitboxCount#
Returns the number of hitboxes for this entity.
GetHitbox#
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#
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#
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#
Returns the entity's root (feet) position.
GetBonePos#
Returns the position of a specific bone. See Bone constants.
GetBoundsMin#
Returns the AABB minimum in local space. Alias for GetDelta1().
GetBoundsMax#
Returns the AABB maximum in local space. Alias for GetDelta2().
GetNametagYPos#
Returns the Y position offset for the entity's nametag.
GetDistance#
Returns the distance from the local player to this entity.
GetFovTo#
Returns the FOV distance in pixels from the screen crosshair to the specified bone.
| Parameter | Type | Description |
|---|---|---|
boneId |
int |
Bone ID (see Bone constants) |
GetScreenOffsetTo#
Returns the 2D screen offset from the crosshair to the specified bone.
PredictPosition#
Predicts the entity's position after time seconds using its current velocity.
| Parameter | Type | Description |
|---|---|---|
time |
float |
Time in seconds to predict ahead |
GetClosestBoneInFov#
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#
Calculates the angle (pitch, yaw, 0) from src to this entity's position.
Outline / Glow#
SetOutline#
Applies an outline to the entity.
| Parameter | Type | Description |
|---|---|---|
outlineType |
int |
1 = visible, 2 = occluded (through walls). See OutlineType. |
color |
Color |
Outline color |
SetOutlineVisible#
Shorthand for SetOutline(1, color). Outline when entity is in line of sight.
SetOutlineOccluded#
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#
A pair of bone IDs representing one connection in a skeleton.
GetSkeletonConnections#
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#
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#
Returns a range over all entities. Use with range-based for loops.
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)