Skip to content

Core#

Defined in Core.hpp. Logging, time, input, screen info, and world-to-screen projection.

Log#

void Log(const char* msg);

Prints a message to the Xenon console. This is the only way to output text for debugging since printf is not available.

Log("Plugin loaded!");
Log("Something happened");

Note

There is no format string support. To log numbers, convert them to a string manually (see FAQ).

LogDebug#

void LogDebug(const char* msg);

Prints a debug-level message to the Xenon console.

LogWarning#

void LogWarning(const char* msg);

Prints a warning-level message to the Xenon console.

LogError#

void LogError(const char* msg);

Prints an error-level message to the Xenon console.


IsIngame#

bool IsIngame();

Returns true if the local player is currently in a match.

if (!IsIngame()) return;

GetMapId#

uint32_t GetMapId();

Returns the current map identifier. The value is game-internal; useful for map-specific logic.

uint32_t map = GetMapId();

GetSensitivity#

float GetSensitivity();

Returns the player's in-game mouse sensitivity setting.

float sens = GetSensitivity();

GetCurrentHero#

uint64_t GetCurrentHero();

Returns the hero pool ID of the local player's current hero. Compare with HeroId constants.

if (GetCurrentHero() == HeroId::Widowmaker)
    Log("Playing Widowmaker");

GetTime#

float GetTime();

Returns the current time in seconds since the application started. Useful for animations and timers.

float t = GetTime();

IsKeyDown#

bool IsKeyDown(int vkey);

Returns true if the specified key is currently held down.

Parameter Type Description
vkey int Virtual key code (see VK constants)
if (IsKeyDown(VK::LButton))
    Log("Left mouse button is held");

if (IsKeyDown(VK::Shift))
    Log("Shift is held");

Tip

For single-press detection, use IsKeyPressed instead.


IsKeyPressed#

bool IsKeyPressed(int vkey);

Returns true only on the frame the key transitions from up to down (leading edge). Use this for toggle behavior or single-fire actions.

Parameter Type Description
vkey int Virtual key code (see VK constants)
if (IsKeyPressed(VK::F1))
    g_enabled = !g_enabled;

IsKeyReleased#

bool IsKeyReleased(int vkey);

Returns true only on the frame the key transitions from down to up (trailing edge).

Parameter Type Description
vkey int Virtual key code (see VK constants)
if (IsKeyReleased(VK::LButton))
    Log("Left mouse button released");

ScreenSize#

Vector2 ScreenSize();

Returns the current screen resolution as a Vector2.

Vector2 size = ScreenSize();
// size.x = width, size.y = height

ScreenCenter#

Vector2 ScreenCenter();

Returns the center of the screen. Equivalent to ScreenSize() * 0.5f.

Vector2 center = ScreenCenter();
Draw::Circle(center, 10.f, Color::White());

WorldToScreen#

Converts a 3D world position to 2D screen coordinates.

Overload 1: Bool return#

bool WorldToScreen(const Vector3& worldPos, Vector2& screenPos);

Returns true if the position is on screen. The result is written to screenPos.

Parameter Type Description
worldPos const Vector3& World-space position
screenPos Vector2& Output: screen-space position
Returns Description
true Position is on screen, screenPos is valid
false Position is behind the camera
Vector3 headWorld = enemy.GetBonePos(Bone::Head);
Vector2 headScreen;
if (WorldToScreen(headWorld, headScreen))
{
    Draw::CircleFilled(headScreen, 5.f, Color::Red());
}

Overload 2: Direct return#

Vector2 WorldToScreen(const Vector3& worldPos);

Returns the screen position directly. If the position is behind the camera, returns {0, 0}.

Vector2 pos = WorldToScreen(enemy.GetPosition());
if (pos.IsValid())
    Draw::Text(pos, Color::White(), "Here");

Tip

Prefer the bool overload — it explicitly tells you whether the projection succeeded. The direct return overload can't distinguish "behind camera" from "top-left corner of screen".


GetCameraPosition#

Returns the camera's world-space position, extracted from the view-projection matrix.

Overload 1: Bool return#

bool GetCameraPosition(Vector3& out);

Returns true if the camera position is available. The result is written to out.

Parameter Type Description
out Vector3& Output: world-space camera position

Overload 2: Direct return#

Vector3 GetCameraPosition();

Returns the camera position directly. Returns {0, 0, 0} if unavailable.

Vector3 cam = GetCameraPosition();
float dist = (enemy.GetPosition() - cam).Length();

GetCameraForward#

Returns the camera's normalized forward direction, derived from the view-projection matrix.

Overload 1: Bool return#

bool GetCameraForward(Vector3& out);

Returns true if the forward direction is available. The result is written to out.

Overload 2: Direct return#

Vector3 GetCameraForward();

Returns the forward direction directly. Returns {0, 0, 0} if unavailable.

Vector3 fwd = GetCameraForward();
Vector3 toEnemy = (enemy.GetPosition() - GetCameraPosition()).Normalized();
float dot = fwd.Dot(toEnemy); // 1.0 = directly ahead, 0.0 = perpendicular

GetViewMatrix#

bool GetViewMatrix(float* out16);

Copies the raw 4x4 view-projection matrix into a 16-float buffer (row-major layout).

Parameter Type Description
out16 float* Output: 16-float buffer for the 4x4 matrix
Returns Description
true Matrix was available and copied
false Not in-game or matrix unavailable
float vp[16];
if (GetViewMatrix(vp))
{
    // vp[0..3]  = row 0
    // vp[4..7]  = row 1
    // vp[8..11] = row 2
    // vp[12..15] = row 3
}

Note

This is a combined view-projection matrix, not a separate view or projection matrix. Use GetCameraPosition() and GetCameraForward() for the common cases — the raw matrix is for advanced use like custom projection or off-screen indicators.


Ability Queries#

All ability queries return data for the local player only.

GetUltCharge#

float GetUltCharge();

Returns the local player's ultimate charge percentage (0–100).

float charge = GetUltCharge();

IsUltReady#

bool IsUltReady();

Returns true if ultimate charge is at 100%.

IsUltActive#

bool IsUltActive();

Returns true if the ultimate ability is currently active.

IsSkill1Active#

bool IsSkill1Active();

Returns true if Skill 1 (Shift) is currently active.

IsSkill2Active#

bool IsSkill2Active();

Returns true if Skill 2 (E) is currently active.

IsSkill3Active#

bool IsSkill3Active();

Returns true if Skill 3 is currently active.

GetHeroState#

uint32_t GetHeroState();

Returns a bitmask of the local player's current state. See HeroState constants.

uint32_t state = GetHeroState();
if (state & HeroState::Ulting)
    Log("Ultimate is active");
if (state & HeroState::Reloading)
    Log("Reloading");

Hero-Specific Charges#

GetRailgunCharge#

float GetRailgunCharge();

Returns Sojourn's railgun charge level. Only meaningful when playing Sojourn.

GetIllariCharge#

float GetIllariCharge();

Returns Illari's solar rifle charge level. Only meaningful when playing Illari.

GetHanzoCharge#

float GetHanzoCharge();

Returns Hanzo's bow draw charge level. Only meaningful when playing Hanzo.

GetWidowCharge#

float GetWidowCharge();

Returns Widowmaker's sniper scope charge level. Only meaningful when playing Widowmaker.

GetLookupSkill#

float GetLookupSkill(uint16_t lookupId);

Generic skill value lookup by ID. Returns cached values for known IDs, 0.0 for unknown IDs.

Parameter Type Description
lookupId uint16_t Skill lookup ID (see SkillId constants)
float charge = GetLookupSkill(SkillId::SojournCharge);
float ult = GetLookupSkill(SkillId::UltCharge);

Note

Only a subset of lookup IDs are currently cached. Unknown IDs return 0.0. See SkillId constants for supported IDs.


Aim Control#

Functions for controlling the local player's view direction. These use the same mechanism as the internal aimbot: writing the direction vector directly into game memory.

Warning

Using aim functions while the internal aimbot is active will cause conflicts. Disable the built-in aimbot for heroes where your plugin handles aiming.

AimSetDirection#

void AimSetDirection(const Vector3& dir);

Sets the view direction vector instantly (no smoothing). The vector is normalized automatically. Resets any active spring smoothing state.

Parameter Type Description
dir const Vector3& Desired view direction (will be normalized)
Vector3 toEnemy = (enemy.GetHeadPos() - GetCameraPosition()).Normalized();
AimSetDirection(toEnemy);

AimGetDirection#

Vector3 AimGetDirection();
bool AimGetDirection(Vector3& out);

Returns the local player's current view direction vector.

Vector3 fwd = AimGetDirection();

AimSetAngles#

void AimSetAngles(float pitch, float yaw);

Sets the view angles in radians (instant, no smoothing). Pitch is clamped to +/-89 degrees. Resets any active spring smoothing state.

Parameter Type Description
pitch float Vertical angle in radians (negative = look up, positive = look down)
yaw float Horizontal angle in radians
Vector3 angles = CalcAngle(GetCameraPosition(), enemy.GetHeadPos());
AimSetAngles(angles.x, angles.z);  // .x = pitch, .z = yaw

AimGetAngles#

Vector2 AimGetAngles();
bool AimGetAngles(float& pitch, float& yaw);

Returns the current view angles as (pitch, yaw) in radians.

Vector2 angles = AimGetAngles();  // .x = pitch, .y = yaw
float pitch, yaw;
AimGetAngles(pitch, yaw);

AimAtPosition#

void AimAtPosition(const Vector3& target, float stiffness = 0.f);

Aims at a world-space position using a critically-damped spring for smooth, human-like motion. Call this every frame while tracking a target.

Parameter Type Description
target const Vector3& World-space position to aim at
stiffness float Spring stiffness: 0 = instant snap, 10-200 = human-like, 500+ = near-instant

The spring model guarantees no overshoot or oscillation. Higher stiffness values mean faster convergence.

// Smooth aim at enemy head
Entity target = FindBestTargetInFov(100.f, Bone::Head, TargetFlags::Enemy | TargetFlags::Visible);
if (target)
    AimAtPosition(target.GetHeadPos(), 80.f);

AimAtBone#

void AimAtBone(int entityIndex, int boneId, float stiffness = 0.f);

Aims at a specific bone on an entity with spring smoothing. Convenience wrapper that resolves the bone position internally.

Parameter Type Description
entityIndex int Player array index
boneId int Skeleton bone ID (see Bone constants)
stiffness float Spring stiffness (same as AimAtPosition)
Entity target = FindBestTargetInFov(100.f, Bone::Head, TargetFlags::Enemy);
if (target)
    AimAtBone(target.Index(), Bone::Head, 50.f);

AimResetSmoothing#

void AimResetSmoothing();

Resets the spring smoothing velocity to zero. Call this when switching targets to prevent the spring's momentum from the previous target carrying over and causing a snap.

if (newTarget != lastTarget)
{
    AimResetSmoothing();
    lastTarget = newTarget;
}
AimAtBone(newTarget.Index(), Bone::Head, 80.f);

AimHitsHitbox#

int AimHitsHitbox(int entityIndex, float hitboxScale = 1.0f);

Checks if the current aim direction passes through any hitbox on the given entity. Use this for fire gating — only fire when the crosshair is actually on the target.

Parameter Type Description
entityIndex int Player array index
hitboxScale float Hitbox radius multiplier (1.0 = exact, >1.0 = forgiving)
Returns Description
>= 0 BodySlot index of the first hit hitbox
-1 No hitbox hit
Entity target = FindBestTargetInFov(100.f, Bone::Head, TargetFlags::Enemy);
if (target)
{
    AimAtBone(target.Index(), Bone::Head, 80.f);

    int slot = AimHitsHitbox(target.Index());
    if (slot == BodySlot::Head)
        PressGameButton(GameButton::LMouse);
    else
        ReleaseGameButton(GameButton::LMouse);
}