3D camera cutting off 2D sprites when tilted

So I’m playing around with the new 3D features, and have run into an issue when combining 2D and 3D elements. I’m using 3D boxes for the the floor and walls, and a 2D sprite with 8 direction animations for isometric angles. The problem occurs when I tilt the camera down from 0 degrees (looking straight down) to 45 degrees for that isometric perspective. All the 3D elements render no problem when I do this, but as the angle increases, my 2D sprite gets cut off along the bounding box of the camera as if it were pointed straight down at 0.

I sketched up a quick visualization of what I THINK is going on. The black box is the starting position of my camera. The yellow box is what the camera sees after being tilted. I’m going for 45, but the problem gets worse the more I tilt, with the cutoff being close to the top of the screen on lower angles like 10 and 15, and off the bottom of the screen on higher angles. And the orange circle is my 2D sprite being displayed ONLY within the bounds of the original camera angle of 0. Adjusting the Y position of the camera only moves my sprite deeper into “not rendered” territory.
3dCameraProblem

What do you think? Is there a solution here? Or am I getting ahead of myself with this new feature?

1 Like

Thanks for you analysis. We observed this bug in other places, we’ll have a look today.
Your hypothesis about what’s going on seems logical so I’ll keep it in mind when debugging thanks!

Ok, this is fixed and will be available in the next release that we will do today

Wow! Totally was not expecting this response, you guys are AMAZING! Finding this engine has reignited my passion for game design, and you guys are dropping the exact features I need right as I start to expand my scope and set myself some real goals. Thank you so much for the response and your amazing work!

1 Like

Just got home, updated Gdevelop, and ran my testing project. The problem persists, at least for me. With a static camera, I can run my character up and down, in and out of the rendered area. Am I missing something else?

Could you send a video of the bug?
And maybe your zipped project so that I can check?

I’d be happy to. Here is a short clip of what’s going on:

The floor is a 3D box with a tiled sprite on the front face. Top down movement controller on the moving sprite, and the only thing in my events sheet is tilting the camera to 15 degrees on the x axis at the start of the scene.

And here’s the zip of the project, all created and built with the most recent 5.1.162 update.

1 Like

I’m not sure the zip was included, can you send it to me by DM?

I think that’s because we don’t have an option yet for the 2D rendering to take the whole screen space when the camera is tilted on either the X axis or the Y axis.
So the 2D canvas has limits that should be the same as if you don’t tilt the camera.
Nevertheless, I’ll check on your project

1 Like

I confirm this is the reason you see your sprite cut.
You should keep in mind that the 2D space is a rectangle in 3D that has limits. You can see those limits when playing with the 3D camera.

Bummer. Is there any way I can shift or expand the 2D canvas? Or position my 2D assets on another layer and fake it? I know the feature is new, but I’m kind of on the fence on how I want to approach the rest of my project, and would definitely prefer the 3D elements giving depth to the environment over faking the isometric angle in the 2d art.

Not at the moment I reckon, sorry for this limitation.

I managed to create the illusion of my 2D sprite interacting within the 3D space using 3 layers. Bottom layer contains the floor, and any 3D assets behind my player, as well as an object to control the players movement and variables that doesn’t need to be visibly rendered to serve its purpose. Middle layer contains my player sprite, pinned to the center of the camera and draped over my player controller like a ghost costume or a warhammer minifig sitting on its base. The top layer contains a camera with the exact same angle settings as the bottom layer so that 3d objects can be shifted back and forth between the two layers based on their position relative to the player controller, with this layer containing everything that the player needs to be able to go behind.

The Vid:

and the Events:

It’s not a perfect or elegant solution, but it works about as well as y-sort did when I was building everything without the 3D elements, and more importantly it allows me to proceed with implementing gameplay without bouncing back and forth between two potential versions of the game. As you can see in the video, it works best with smaller objects, so I’ll just have to design my maps with that in mind.

1 Like

That’s clever!
On your way to build your own Hades?

haha, something like that, art decisions will depend on if I can figure out a similar workaround for the enemies. They aren’t fixed to the center of the screen, so translating their sprite position to the camera is tricky, and I suck at trig