Hello Guest

Author Topic: Depth issue.  (Read 3270 times)

Shinugami

  • Newbie
  • *
  • Posts: 1
    • View Profile
Depth issue.
« on: January 19, 2013, 04:58:42 am »
I have 3 objects in this problem.

Object 1: The animatedSprite of a character
Object 2: The TileMap object
Object 3: The 2dtk camera

My problem is that I am using the tileMap as a plane. The camera is rotated to look at the tileMap from a 45x and 45y degree rotation (like an isometric angle). As my animated sprite move over the tileMap, there is a point where the tileMap which is behind the animatedSprite is drawn over the animatedSprite. Is there some depth option I am missing? Can I alter some draw order code to fix this?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Depth issue.
« Reply #1 on: January 19, 2013, 04:07:22 pm »
If you're using an orthographic (the tk2dCamera is orthographic) camera, you can simply move the tilemap way back in z. That will ensure it gets drawn before everything else. You can increase the far z plane on your camera if it isn't sufficient.

The character should appear closest to the camera, so you'd want to keep that on a close z distance from the camera.

That should be sufficient to get this working. There are other methods to get this working, multiple cameras, material draw order and so on, but this by far requires the least work.