Posts

Showing posts from November, 2023

Godot - Rotating a Camera in 3d space

Image
For the past couple of years I've been dabbling about in Unity, but due to their recent PR disaster, I've shifted over into dabbling with Godot instead. The project I'm trying to create is a turn-based strategy game, which would include terrain. As such, units might be hidden behind terrain, so the user should be able to rotate the camera. To this end I've been following the Godot tutorials, creating a 3d plane, and putting a box in one corner so that I can see how the whole thing would rotate (if it were a plain plane, I wouldn't be able to tell it rotated). I didn't bother putting in a player character yet (as the concept is quite different to the example in the tutorial), but I did follow the steps  for implementing a camera. I wanted the camera to rotate by increments of 90 degrees (so there would effectively be 4 positions). Unfortunately, most of the maths in the documentation is about radians, which doesn't seem useful to me for this case, as it makes