AngleToVector

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


Actor

native clearscope static Vector2 AngleToVector(double angle, double length = 1)

Usage

Converts the given angle into a 2D vector that points in the direction of the angle.

Due to being static and clearscope, can be called from anywhere, but when calling from a non-Actor class, has to be called as Actor.AngleToVector.

Parameters

  • double angle
The direction the vector should point
  • double length
Default is 1. The magnitude of the vector

Return value

Returns a Vector2 pointing in the direction of the angle.

Examples

See an example of use here (combined with TestMobjLocation).