vec3_t

vec3_t represents a three-dimensional vector commonly used in 3D space calculations, such as positions, directions, and velocities.

Declaration:

class vec3_t
{
    float x;
    float y;
    float z;
    
    // calculates the Euclidean distance between this vector and another.
    float distance(const vec3_t&in to);
    
    // calculates the dot product between this vector and another.
    float dot(const vec3_t&in to);
    
    // calculates the magnitude (length) of the vector.
    float length();
    
    // calculates the magnitude of the vector in 2D space (ignoring the z-component).
    float length_2d();
    
    // alias for length().
    float magnitude();
    
    // calculates the cross product between this vector and another.
    vec3_t cross(const vec3_t&in to);
    
    // all operators registered (with their respective operation)
    bool opEquals(const vec3_t& in) const; // ==
    bool opNotEquals(const vec3_t &in) const; // !=
    vec3_t opAdd(const vec3_t&in) const; // +
    vec3_t opSub(const vec3_t&in) const; // -
    vec3_t opMul(float) const; // *
    vec3_t& opDiv(float); // /
    vec3_t& opAddAssign(const vec3_t&in); // +=
    vec3_t& opSubAssign(const vec3_t&in); // -=
    vec3_t& opMulAssign(float); // *=
    vec3_t& opDivAssign(float); // /=
}

Constructors:

Examples:

Sample code to get the distance to an enemy target

Sample code to calculate player's movement speed

Sample code to convert a 3D world position to a 2D screen position for ESP

Last updated

Was this helpful?