Skip to main content

Vector2

Vector2 class

Properties

x: number

y: number

Functions

IsValid

Vector2:IsValid() boolean

Returns whether this vector is not (0, 0)


To3D

Vector2:To3D() Vector3

Returns a Vector3 (x =x, y =0, z=y).


To2D

Vector2:To2D() Vector2

Returns a Vector2 (x =x, y =y).


Copy

Vector2:Copy() Vector2

Returns a Vector2 (x =x, y =y).


Project

Vector2:Project() Vector3

Returns a game world position Vector3 (ScreenToWorld).


ProjectOnLine

Vector2:ProjectOnLine(
A: Vector2,
B: Vector2
) Vector2

ArgumentTypeDescription
AVector2Line start.
BVector2Line end.

Returns project on line AB.


ProjectOnLineSegment

Vector2:ProjectOnLineSegment(
A: Vector2,
B: Vector2
) Vector2

ArgumentTypeDescription
AVector2Line segment start.
BVector2Line segment end.

Returns project on line segment AB.


IsOnLineSegment

Vector2:IsOnLineSegment(
A: Vector2,
B: Vector2
) boolean

ArgumentTypeDescription
AVector2Line segment start.
BVector2Line segment end.

Returns if point's project is on line segment AB.


IsLineSegmentIntersection

Vector2:IsLineSegmentIntersection(
B: Vector2,
C: Vector2,
D: Vector2
) boolean

ArgumentTypeDescription
BVector2
CVector2
DVector2

Returns whether AB intersects CD.


VectorIntersection

Vector2:VectorIntersection(
B: Vector2,
C: Vector2,
D: Vector2
) Vector2

ArgumentTypeDescription
BVector2
CVector2
DVector2

Returns intersection between AB and CD.


Length

Vector2:Length() number

Returns vector length.


Length2

Vector2:Length2() number

Returns vector length square.


Distance

Vector2:Distance( v2: Vector2 ) number

ArgumentTypeDescription
v2Vector2Point 2

Returns distance from v to v2.


Distance2

Vector2:Distance2( v2: Vector2 ) number

ArgumentTypeDescription
v2Vector2Point 2

Returns distance square from v to v2.


Dot

Vector2:Dot( v2: Vector2 ) number

ArgumentTypeDescription
v2Vector2Point 2

Returns dot result.


Cross

Vector2:Cross( v2: Vector2 ) number

ArgumentTypeDescription
v2Vector2Point 2

Returns cross result.


Normalize

Vector2:Normalize() void

Normalizes this vector


Normalized

Vector2:Normalized() Vector2

Returns a normalized vector from this vector.


Extend

Vector2:Extend(
v2: Vector2,
distance: number
) void

ArgumentTypeDescription
v2Vector2
distancenumber(float)

Extends this vector towards given vector.


Extended

Vector2:Extended(
v2: Vector2,
distance: number
) Vector2

ArgumentTypeDescription
v2Vector2
distancenumber(float)

Returns extended vector towards given vector.


Shorten

Vector2:Shorten(
v2: Vector2,
distance: number
) void

ArgumentTypeDescription
v2Vector2
distancenumber(float)

Shortens this vector towards given vector.


Shortened

Vector2:Shortened(
v2: Vector2,
distance: number
) Vector2

ArgumentTypeDescription
v2Vector2
distancenumber(float)

Returns shortened vector towards given vector.


Lerp

Vector2:Lerp(
v2: Vector2,
time: number - float
) Vector2

ArgumentTypeDescription
v2Vector2Point 2
timenumber - floatTime.

Returns Linear interpolation. V1 + s (V2-V1)


Angle

Vector2:Angle() number

Returns this vector angle.


AngleDeg

Vector2:AngleDeg() number

Returns this vector angle degree.


AngleBetween

Vector2:AngleBetween( v2: Vector2 ) number

ArgumentTypeDescription
v2Vector2Point 2

Returns angle between this and v2.


AngleDegBetween

Vector2:AngleDegBetween( v2: Vector2 ) number

ArgumentTypeDescription
v2Vector2Point 2

Returns angle degree between this and v2.


Rotate

Vector2:Rotate( angle: number - float ) Vector2

ArgumentTypeDescription
anglenumber - floatRotation angle.

Returns vector rotated at a given radian angle.


RotateDeg

Vector2:RotateDeg( angle: number - float ) Vector2

ArgumentTypeDescription
anglenumber - floatRotation angle.

Returns vector rotated at a given degree angle.


Unpack

Vector2:Unpack() number, number

Returns two numbers x,y.


ToCell

Vector2:ToCell() NavGridCell

Returns NavGridCell from this position.


RelativePos

Vector2:RelativePos(
v2: Vector2,
distance: number - float
) Vector2

ArgumentTypeDescription
v2Vector2Point 2
distancenumber - floatDistance to extended.

Returns relative position in direction from v to v2 as Vector2.


Randomize

Vector2:Randomize() Vector2

Randomizes vector a little.


Direction

Vector2:Direction( v2: Vector2 ) Vector2

ArgumentTypeDescription
v2Vector2Point 2

Returns normalized direction vector from v to v2.


Normal

Vector2:Normal() Vector2

Returns normal.


IsInRange

Vector2:IsInRange(
v2: Vector2,
range: number
) boolean

ArgumentTypeDescription
v2Vector2Point 2
rangenumber(float)

Returns whether this vector is within certain range of other given Vector2.


IsInRange

Vector2:IsInRange(
v2: Vector3,
range: number
) boolean

ArgumentTypeDescription
v2Vector3Point 2
rangenumber(float)

Returns whether this vector is within certain range of other given Vector3.


DistanceToVec3

Vector2:DistanceToVec3( v2: Vector3 ) number

ArgumentTypeDescription
v2Vector3Point 2

Returns distance from this to v2.


DistanceToLine

Vector2:DistanceToLine(
A: Vector3,
B: Vector3
) number

ArgumentTypeDescription
AVector3Line start.
BVector3Line end.

Returns distance from this to line AB.


DistanceToLine2

Vector2:DistanceToLine2(
A: Vector3,
B: Vector3
) number

ArgumentTypeDescription
AVector3Line start.
BVector3Line end.

Returns distance square from this to line AB.


IsUnderEnemyTurret

Vector2:IsUnderEnemyTurret() boolean

Returns if vector2 is under enemy turret.


IsUnderAllyTurret

Vector2:IsUnderAllyTurret() boolean

Returns if vector2 is under ally turret.


CountAlliesInRange

Vector2:CountAlliesInRange( range: number ) number

ArgumentTypeDescription
rangenumberCheck range.

Returns if how many valid allies is in vector2 range(include me).


CountAllyLaneMinionsInRange

Vector2:CountAllyLaneMinionsInRange( range: number ) number

ArgumentTypeDescription
rangenumberCheck range.

Returns if how many valid ally minions is in vector2 range.


CountEnemiesInRange

Vector2:CountEnemiesInRange( range: number ) number

ArgumentTypeDescription
rangenumberCheck range.

Returns if how many valid enemies is in vector2 range.


IsWall

Vector2:IsWall( actorTeam: number - integer ) boolean

ArgumentTypeDescription
actorTeamnumber - integerActor team to check special air wall (300 == ignore air wall).

Returns if this position is not passable through static obstacles.


IsWallDynamic

Vector2:IsWallDynamic( teamFlag: number - integer ) boolean

ArgumentTypeDescription
teamFlagnumber - integerUse AIBaseClient::GetNavConditionFlags()

Returns if this position is not passable through both static and dynamic obstacles.


IsGrass

Vector2:IsGrass() boolean

Returns if this position is grass.


IsWater

Vector2:IsWater() boolean

Returns if this position is water.


IsWallOfType

Vector2:IsWallOfType(
cellFlag: CellFlag,
radius: number
) boolean

ArgumentTypeDescription
cellFlagCellFlag
radiusnumber

Returns if this position has certain CellFlag. Can be used to check position near grass for example.