How to move the pivot point of a node2d object to be the viewport center when translating/rotating the node2d object

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By alencosoft
:warning: Old Version Published before Godot 3 was released.

I have a background (larger than the viewport) that rotates and moves. I need the pivot point of this background to always be the center of the viewport.

My situation: Instead of moving my game player left and right around the viewport, the background rotates and moves and the player is static (center of viewport and always facing up (-y). So, as the player looks right (1 degree at a time), for example, the background should rotate 1 degree to the left. If the player moves (up arrow on keyboard) the background needs to move down (+y). But the background could be upside down at that point. I’ve looked into the “Matrices and transforms” tut but don’t understand any of it. Please help.

Is your game using polar coordinates? Or do you mean your player simply can rotate around itself and go anywhere?
I think using a Camera2D would be easier than moving everything else.

Zylann | 2016-11-18 14:27

It’s a top-down world. There are ships moving around the world and the user’s ship is centered on the map. So, I don’t believe the suggestion you made will work.

alencosoft | 2016-11-18 22:46