Class: PositionHelper

PositionHelper()

new PositionHelper()

Source:

Methods

DistanceBetweenEntities(firstEntity, secondEntity) → {number}

Parameters:
Name Type Description
firstEntity number The entityID of an entity.
secondEntity number The entityID of an entity.
Source:
Returns:
- The horizontal distance between the two given entities. Returns infinity when the distance cannot be calculated.
Type
number

EntitiesNearPoint(origin, radius, players, iid) → {Array.<number>}

Parameters:
Name Type Description
origin Vector2D The point to check around.
radius number The radius around the point to check.
players Array.<number> The players of which we need to check entities.
iid number Interface IID that returned entities must implement. Defaults to none.
Source:
Returns:
The id's of the entities in range of the given point.
Type
Array.<number>

GetSpawnPosition(target, entity, forced) → {Vector3D}

Parameters:
Name Type Description
target number EntityID to find the spawn position for.
entity number EntityID to find the spawn position for.
forced boolean Optionally whether the spawning is forced.
Source:
Returns:
- An appropriate spawning position.
Type
Vector3D

InterpolatedLocation(ent, lateness) → {Vector3D}

Gives the position of the given entity, taking the lateness into account. Note that vertical movement is ignored.
Parameters:
Name Type Description
ent number Entity id of the entity we are finding the location for.
lateness number The time passed since the expected time to fire the function.
Source:
Returns:
The interpolated location of the entity.
Type
Vector3D

PredictTimeToTarget(firstPosition, selfSpeed, targetPosition, targetVelocity) → {number|boolean}

Get the predicted time of collision between a projectile (or a chaser) and its target, assuming they both move in straight line at a constant speed. Vertical component of movement is ignored.
Parameters:
Name Type Description
firstPosition Vector3D The 3D position of the projectile (or chaser).
selfSpeed number The horizontal speed of the projectile (or chaser).
targetPosition Vector3D The 3D position of the target.
targetVelocity Vector3D The 3D velocity vector of the target.
Source:
Returns:
- The time to collision or false if the collision will not happen.
Type
number | boolean

TestCollision(ent, point, lateness) → {boolean}

Test if a point is inside an entity's footprint. Note that edges may be not included for square entities due to rounding.
Parameters:
Name Type Description
ent number Id of the entity we are checking with.
point Vector3D The point we are checking with.
lateness number The time passed since the expected time to fire the function.
Source:
Returns:
True if the point is inside of the entity's footprint.
Type
boolean