API Docs for: 1.13.1
Show:

game.Vector Class

Extends game.Class
Module: physics

Vector class.

Constructor

game.Vector

(
  • [x]
  • [y]
)

Parameters:

  • [x] Number optional
  • [y] Number optional

Methods

add

(
  • x
  • [y]
)
game.Vector

Add to vector values.

Parameters:

Returns:

angle

(
  • vector
)
Number

Get angle between two vectors.

Parameters:

Returns:

Number:

angleFromOrigin

(
  • vector
)
Number

Get angle between two vectors from origin.

Parameters:

Returns:

Number:

clone

() game.Vector

Clone vector.

Returns:

copy

(
  • v
)
game.Vector

Copy values from another vector.

Parameters:

Returns:

distance

(
  • vector
)
Number

Get distance of two vectors.

Parameters:

Returns:

Number:

divide

(
  • x
  • [y]
)
game.Vector

Divide vector values.

Parameters:

Returns:

dot

(
  • [vector]
)
Number

Get dot of vector.

Parameters:

Returns:

Number:

dotNormalized

(
  • [vector]
)
Number

Get normalized dot of vector.

Parameters:

Returns:

Number:

length

() Number

Get length of vector.

Returns:

Number:

limit

(
  • vector
)
game.Vector

Limit vector values.

Parameters:

Returns:

multiply

(
  • x
  • [y]
)
game.Vector

Multiply vector values.

Parameters:

Returns:

multiplyAdd

(
  • x
  • [y]
)
game.Vector

Multiply and add vector values.

Parameters:

Returns:

normalize

() game.Vector

Normalize vector.

Returns:

rotate

(
  • angle
)
game.Vector

Rotate vector in radians.

Parameters:

  • angle Number

Returns:

round

() game.Vector

Round vector values.

Returns:

set

(
  • x
  • y
)
game.Vector

Set vector values.

Parameters:

  • x Number
  • y Number

Returns:

subtract

(
  • x
  • [y]
)
game.Vector

Subtract from vector values.

Parameters:

Returns: