I am unsure of how I need to code this behavior. Conceptually its simple, but I don’t understand vector math well enough to see how to do it.
I just want my object to move to a specified point at a specified speed. It’s so simple I feel like I’m missing something obvious.
I’m applying this to a rigidbody2D. I have a vector2 for the position I need to move to, and a float for the speed I want it to move at. So I need to find an angle that would point from the object’s position to its destination, and I need to set a magnitude for that angle according to my object’s speed.
I feel like I’ve done this before, but I can’t recall when, so I don’t know where to find my own example code.
How do I perform this math?