# Rotate object around origin

Attention Topic was automatically imported from the old Question2Answer platform.

Hello,

I do not know how to rotate a object around the origin. A local rotation is no problem but the rotation around the origin does not work…
If it is possible I like to use Transform2D because it is available to all Nodes2D

Here is an example code:

``````extends Sprite

var v = Transform2D()
v = v.rotated(PI/2)
v = v.translated( Vector2(100,0) )
v[2] += Vector2(100,0)
self.transform = v
``````

I like to rotate the sprite around Vector2(100,0) with a distance of Vector2(100,0)
I guess the solution is one line but I am not able to find it in the documentation…

``````var point = Vector2(100, 0)
``````

To place your node at a specific angle around a given point:

``````position = point + Vector2(cos(angle), sin(angle)) * distance
``````

To make your node rotate around that point, while keeping the same distance:

``````position = point + (position - point).rotated(angle)
``````

To make it look at the point:

``````look_at(point)
``````