Questions about 2D game in 3D view

Hi everyone, I am working on a 2D card Game in a 3D view. A lot of 3D problems come to me, but I am not good at 3D math. So will you please help me with these questions?

  1. 3D camera setting. I used camera setting and render script from the example projection of the manual. but there rests problem with the depth testing. the higher Z not covers the lower one.
  2. 3D mouse testing. I think there are two solutions. one is to create collision objects and ray cast from the mouse position in the physic world by the camera rotation to a point with distance enough alone the rotation. the second solution is to calculate the shadow of the object aabb to the camera plane and treat it as a 2D thing.
    I have no experience in 3D game. so the question may not be professional, sorry for that. And if you could provide an example, that will be fantastic ! Thanks a lot. :wink:

by the way, all the textures are from the web. and for test only…

As to question 1:
Can you post your render script’s update function? I guess the important part is that

render.set_depth_mask(true)
render.enable_state(render.STATE_DEPTH_TEST)

is enabled before you draw the cards.

1 Like

Thank you. I surely add depth test in the render script. But if the lower z object is large enough to cover some part of higher z, it will cover all the higher z . I don’t know why.:open_mouth: