# Rotate around a Vector2 in 2D

Attention Topic was automatically imported from the old Question2Answer platform.

I have a `Node2D` “Asteroid” that I want to rotate around specific `Vector2`.
In my case, the Asteroid gets spawned randomly on the map. I want to rotate it around the center of my map, in my case `Vector2(mapSize / 2, mapSize / 2)`

How can I do this?

In Unity they had something like “RotateAround” but it seems this is not the case in Godot. I’m really bad in maths and don’t know how to work with `sin` and `cos`

what i usually do in cases like that is parent to a pivot(position2D) and rotate the pivot.

puzzlebeast | 2021-04-01 22:39

Have you considered making your map from `-map_size / 2` to `map_size / 2` instead of `0` to `map_size`? Then `(0, 0)` would be the center.

Aaron Franke | 2021-04-01 18:24

Here is a very basic solution :

``````extends Node2D
var angle = 0
var rotation_speed = 1
``````
``````var center

# Called when the node enters the scene tree for the first time.
center = \$Sprite.position

func _process(delta):
angle = lerp(angle, deg2rad(360), rotation_speed * delta)
var coord = (Vector2(cos(angle), sin(angle)) * radius) + center
\$Sprite2.position = coord
``````func rotate_around_point(vec: Vector2, center: Vector2, angle:float) -> Vector2: