Mathematical operations for Vector2 signals #967
Labels
a-core
Relates to the core package
b-enhancement
New feature or request
c-accepted
The issue is ready to be worked on
Description
Modifying a vector by applying some operation (addition, subtraction, etc) is currently really verbose.
Imagine you want to animate the position of
node
by moving it by[200, 400]
relative to its current position:In general, whenever we want to derive the new value of a signal using its current value things become verbose.
Proposed solution
Introduce a set of methods for Vector2 signals that reflect the operations of the
Vector2
class.These could be used to either tween or immediately modify the signal, just like you normally would:
On top of that, a new
edit
method should be introduced to derive the new value in whatever way necessary:While on itself still pretty verbose, this interface would allow you to create reusable functions for operations that are not natively supported.
Imagine you want to snap the vector to a
20x20
grid:The text was updated successfully, but these errors were encountered: