RotateVector

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


Actor

native clearscope static Vector2 RotateVector(Vector2 vec, double angle)

Usage

Rotates a 2D vector by the given angle. Used to get a vector to point in a new direction without modifying the magnitude of the vector.

Note: Despite being defined in Actor, this function is clearscope (can be called in any class or scope). In classes that aren't based on Actor, it has to be called as Actor.RotateVector.

Parameters

  • Vector2 vec
The 2D vector to rotate
  • double angle
How many degrees to rotate the vector by. Negative values rotate it clockwise while positive values rotate it counterclockwise.

Return value

Returns the rotated Vector2.

Examples

Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contributions are greatly appreciated.