2

Enhance Vector2 Class with Common Mathematical Operations

Suggested by
on May 13, '26
Open

The Vector2 class in the scripting API is already quite capable, but it still lacks many commonly used mathematical operations.

Because of these omissions, scripters often need to implement their own helper methods and utility classes for routine tasks such as calculating directions, angles, and other vector-based operations.

This leads to duplicated code across projects and prevents scripts from relying on a single, standardized API.

Providing these operations directly in Vector2 would significantly improve usability and consistency. Instead of maintaining custom helper classes, developers could use built-in methods that are familiar, well-tested, and shared across all scripts.

Game engines take this approach. For example, Godot Engine includes a comprehensive Vector2 API with a wide range of mathematical functions, making vector manipulation much more straightforward and reducing the need for external utilities.

See: https://docs.godotengine.org/en/stable/classes/class_vector2.html

As an example, I made a helper class to avoid rewriting this functionality in my scripts: https://github.com/dsafxP/Power-ups-Deluxe/blob/main/Helpers/Vector2Helper.cs

Watchers

No comments yet.
Loading comments...
Loading comments...
0 comments loaded

Sign in to comment on this suggestion. Sign In