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
| Argument | Type | Description | 
|---|---|---|
| A | Vector2 | Line start. | 
| B | Vector2 | Line end. | 
Returns project on line AB.
ProjectOnLineSegment
Vector2:ProjectOnLineSegment(
  A: Vector2,
  B: Vector2
) → Vector2
| Argument | Type | Description | 
|---|---|---|
| A | Vector2 | Line segment start. | 
| B | Vector2 | Line segment end. | 
Returns project on line segment AB.
IsOnLineSegment
Vector2:IsOnLineSegment(
  A: Vector2,
  B: Vector2
) → boolean
| Argument | Type | Description | 
|---|---|---|
| A | Vector2 | Line segment start. | 
| B | Vector2 | Line segment end. | 
Returns if point's project is on line segment AB.
IsLineSegmentIntersection
Vector2:IsLineSegmentIntersection(
  B: Vector2,
  C: Vector2,
  D: Vector2
) → boolean
| Argument | Type | Description | 
|---|---|---|
| B | Vector2 | |
| C | Vector2 | |
| D | Vector2 | 
Returns whether AB intersects CD.
VectorIntersection
Vector2:VectorIntersection(
  B: Vector2,
  C: Vector2,
  D: Vector2
) → Vector2
| Argument | Type | Description | 
|---|---|---|
| B | Vector2 | |
| C | Vector2 | |
| D | Vector2 | 
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
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
Returns distance from v to v2.
Distance2
Vector2:Distance2( v2: Vector2 ) → number
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
Returns distance square from v to v2.
Dot
Vector2:Dot( v2: Vector2 ) → number
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
Returns dot result.
Cross
Vector2:Cross( v2: Vector2 ) → number
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 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
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | |
| distance | number | (float) | 
Extends this vector towards given vector.
Extended
Vector2:Extended(
  v2: Vector2,
  distance: number
) → Vector2
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | |
| distance | number | (float) | 
Returns extended vector towards given vector.
Shorten
Vector2:Shorten(
  v2: Vector2,
  distance: number
) → void
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | |
| distance | number | (float) | 
Shortens this vector towards given vector.
Shortened
Vector2:Shortened(
  v2: Vector2,
  distance: number
) → Vector2
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | |
| distance | number | (float) | 
Returns shortened vector towards given vector.
Lerp
Vector2:Lerp(
  v2: Vector2,
  time: number - float
) → Vector2
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
| time | number - float | Time. | 
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
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
Returns angle between this and v2.
AngleDegBetween
Vector2:AngleDegBetween( v2: Vector2 ) → number
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
Returns angle degree between this and v2.
Rotate
Vector2:Rotate( angle: number - float ) → Vector2
| Argument | Type | Description | 
|---|---|---|
| angle | number - float | Rotation angle. | 
Returns vector rotated at a given radian angle.
RotateDeg
Vector2:RotateDeg( angle: number - float ) → Vector2
| Argument | Type | Description | 
|---|---|---|
| angle | number - float | Rotation 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
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
| distance | number - float | Distance 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
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
Returns normalized direction vector from v to v2.
Normal
Vector2:Normal() → Vector2
Returns normal.
IsInRange
Vector2:IsInRange(
  v2: Vector2,
  range: number
) → boolean
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector2 | Point 2 | 
| range | number | (float) | 
Returns whether this vector is within certain range of other given Vector2.
IsInRange
Vector2:IsInRange(
  v2: Vector3,
  range: number
) → boolean
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector3 | Point 2 | 
| range | number | (float) | 
Returns whether this vector is within certain range of other given Vector3.
DistanceToVec3
Vector2:DistanceToVec3( v2: Vector3 ) → number
| Argument | Type | Description | 
|---|---|---|
| v2 | Vector3 | Point 2 | 
Returns distance from this to v2.
DistanceToLine
Vector2:DistanceToLine(
  A: Vector3,
  B: Vector3
) → number
| Argument | Type | Description | 
|---|---|---|
| A | Vector3 | Line start. | 
| B | Vector3 | Line end. | 
Returns distance from this to line AB.
DistanceToLine2
Vector2:DistanceToLine2(
  A: Vector3,
  B: Vector3
) → number
| Argument | Type | Description | 
|---|---|---|
| A | Vector3 | Line start. | 
| B | Vector3 | Line 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
| Argument | Type | Description | 
|---|---|---|
| range | number | Check range. | 
Returns if how many valid allies is in vector2 range(include me).
CountAllyLaneMinionsInRange
Vector2:CountAllyLaneMinionsInRange( range: number ) → number
| Argument | Type | Description | 
|---|---|---|
| range | number | Check range. | 
Returns if how many valid ally minions is in vector2 range.
CountEnemiesInRange
Vector2:CountEnemiesInRange( range: number ) → number
| Argument | Type | Description | 
|---|---|---|
| range | number | Check range. | 
Returns if how many valid enemies is in vector2 range.
IsWall
Vector2:IsWall( actorTeam: number - integer ) → boolean
| Argument | Type | Description | 
|---|---|---|
| actorTeam | number - integer | Actor 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
| Argument | Type | Description | 
|---|---|---|
| teamFlag | number - integer | Use 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
| Argument | Type | Description | 
|---|---|---|
| cellFlag | CellFlag | |
| radius | number | 
Returns if this position has certain CellFlag. Can be used to check position near grass for example.