I have a point1 (Vector2), I want this point to rotate around another point2 (Vector2) (On the same node without adding new nodes).
The rotated () function works but rotates point1 around the origin of the scene. How do I make the center of rotation of point1 be point2?
I try to do it with Transform 2D but I know how, and when I try to multiply Vector2 with Transform 2D it can't. To visualize it I simply draw a small circle at the position of point 1 in _draw() function.

The rotated () function works but rotates point1 around the origin of the scene. How do I make the center of rotation of point1 be point2?

You just need to add point2 to the result. ;) Also take a look at this answer.

answered May 24 by (8,986 points)
selected May 24

Thanks, what is easy sometimes becomes difficult...My function to move the point and rotate it:

`````` func rotated_point(_center, _angle, _distance):
return _center + Vector2(sin(_angle),cos(_angle)) * _distance
``````
``````var diff = point1 - point2