|Topic was automatically imported from the old Question2Answer platform.
So I’ve fallen in love with the engine - this might be the thing I needed 20 years ago, when tried to make a game, hehe :D.
Anyway - to the point…
I am trying to make a shoot-em-up game. Starting as simple as possible, so I do have a character node rigid body and camera2d as a child node. Drag margins all set to 1 to be able to set offset freely, and rotation enabled.
So I do want the player to be always in the middle horizontally and in the lower half of the screen vertically, always top of the screen facing front of the player.
Everything works fine - the camera follows the player, smoothly (sometimes bit jittery, but nevermind that for now). But when the picture rotates, the offset does not rotate properly - meaning that 90 degrees makes player to appear to the right of the screen, 180 top, 270 left and 0 bottom again. While I want it to be always bottom.
I’ve tried to work around this by calculating offset based on the rotation using sin/cos duo and it seemed a good idea, but the problem is then with the aspect ratio or something similar - while I’ve managed to keep the player centered in the bottom half of the screen, it is slightly lower in 90 and 270 degrees meanning that rotation changes the aspect ratio of offsets.
I do hope I’ve made my problem clear here…
So - how should I approach this problem? Clearly multiplication by the aspect ratio does not solve this problem, as I’ve tried this - is also off by few percent…
Maybe there is some magic trick to get around this issue?
Ot maybe I should scrap the built in camera and try to write it all by myself? I would really prefer to stay with the built ins as a beginner :)…
Or maybe it is a bug / unexpected behaviour?
I do use the Steam Godot Stable 3.0.6.
Thanks in advance for any advice