How camera works?

Everything is clear at the end, the problem I think is the amount of information at the entry point, when less is better.

Resulted that was in fact as easy as one line, the one that shared in the first post:

And what happens to him maybe was the same to me, that I got a black screen, freaked out and jumped to the documentation to make it worst. Because view of the camera do not center the screen on the position of the camera, but in the left bottom of it.

Where is the source of the confusion that may happen to any new user. I reach the docs and instead of just trying blindly the code I read everything to try to understand how it works, but making it worst, it scare me since I’m no longer familiar with View and Projection transformation matrices.
After this good read: Coding Labs :: World, View and Projection Transformation Matrices, I realised that in fact I did something with it back in the university ( 15 years ago), with DirectX; but still dont’ need it today anyway. After that even working as 3D modeler and playing with UE4 never had to deal with view and projection matrices again. And most 2D game engines hide that low level setup leaving to us just to play with X,Y coordinates.

My recommendation:
Leave the current documentation as it is, is perfect in fact, for those wanting the low level.
Create an additional page, call it: 2D Camera.
And trying to keep it simple do something like this draft:

  • Introduction + mention the camera could have many advanced options linking to current camera manual.
  • Creating the camera as component of game object, ignore the FOV stuff. (Don’t even mention perspective and frustum culling :grimacing: )
  • Using the camera. Drop the little line of code. (Skip the render script info for now, it scare people).
  • Quickly explain the offset thing, the camera origin is not in the center of the screen.
  • Tell to make the camera follow the player GO put it as child of your player.
  • To control it independently update the GO position containing the camera with go.set_position.
  • Tell everything is ready! it works! everything will be fine!.. unless you want more then invite to follow up the reading to the full Camera manual.

I believe many people will fall in this category of need only 2D scrolling, not even zoom, for many kind of games. Would be a good place to add a second part for the Movement Tutorial where you simple add a “2D camera” as child of the spaceship.

I’m liking Defold, that’s why I put time to be critic and want that It could be accessible for many more users.

5 Likes