Skip to content

format

typescript
Vector2.Add(rhs)

class: Vector2

description

Adds the current vector object with another vector or a number, and returns the resulting vector.

parameter

param_nametypedescription
rhsnumber|Vector2The vector or number to add.

reture

typedescription
Vector2Returns a new Vector2 object representing the result of adding the current vector object with rhs.

code example

typescript
let v2 = new Vector2(-1, -2);
let add_number = v2.Add(1);
let add_v2 = v2.Add(new Vector2(2, 3));