GDevelop Question: How to Sort Objects Relative to the Camera Angle?

Hello, everyone. I would like to ask about Y-Sorting. Is it possible to have the Y-Sorting relative to the camera angle? Y-Sort only works if the camera angle is on default. However, I would like to make a game where the camera rotates. Can anyone help? Thank you.

I would look at using sine & cosine functions on the camera rotation, and multiplying each by the object’s X & Y positions to get an its Y-sort order value.

So, in pseudo code, something like cos(Camera.angle) * object.X() + sin(Camera.angle) * object.Y().

3 Likes

Thank you very much for the reply! I will surely try this. :slight_smile: