2D Toolkit Forum
2D Toolkit => Support => Topic started by: iTris666 on June 11, 2012, 05:51:04 pm
-
Hi,
I'm trying to mix a 2D procedural mesh (on all vertices z == 0 ) and sprites. I try to have some sprites on front then my mesh then a lot of sprites behind.
The problem is that my mesh is always in front of all sprites even if the z value would place it between sprites.
First I tried with my own shader : a very simple shader with light off and blending a constant color.
Since it didn't work I tried with tk2D own BlendVertexColor shader, but the result is the same.
Strangely enough I can order 2 of my meshes by using the z value of their transform ( like I do with the sprites ), but the sprite will never be drawn on front of my mesh.
The sprites I use are either tk2DSprites or tk2DAnimatedSprites ( no sprite batcher ).
Any ideas on how to have my mesh z ordering respected ?
-
Hi iTris666,
Did you calculate bounds for the mesh after creating it?
-
Thanks,
Actually I did call mesh.RecalculateBounds() but it was messed up but the fact that I added an invalid point at -10000 -10000 -10000. which put the center of bounds at -5000 instead of 0. setting the point at -10000 -10000 0 fixed the problem.
-
Glad its sorted now