Skip to content

3.3.1 Vector

Jonas de Luna Skulberg edited this page Oct 15, 2023 · 3 revisions

Vector

Extends:

Implements:

Parameters:

Required:

  • position: InputPosition Origin of the vector, that is, displacement off origo for the origin.
  • vector: InputPosition The actual vector that is to be defined.

Optional:

  • color?: number Color of the vector.
  • normalize?: boolean Whether the vector should be normalized.

Default Parameters:

  color: 0x000000,
  normalize: true,

Implemented Methods:

  • collidesWith(other: Object3D): boolean
  • distanceTo(other: Object3D<Event>): number

Methods

  • setAngleVector(position: InputPosition) Set the angle vector.
  • setNormalizedAngleVector(position: InputPosition) Set the angle vector to a normalized vector of the input.
  • setOriginPoint(position: InputPosition) Set the origin point of the vector.
  • normalize() Normalize the vector.
  • getAngle(): number Get the current angle.
  • getX(): number Get the current x value of the vector.
  • getY(): number Get the current y value of the vector.
  • getNormalizedX(): number Get the current x value of the vector normalized.
  • getNormalizedY(): number Get the current y value of the vector normalized.

Clone this wiki locally