Layering with distances

I’m using the distance to an object to determine which layer it should be displayed on, but I can’t seem to get it to work right. Testing the code while in the editor makes it seem like the equations are correct but it just doesn’t work :frowning:
Display code is in “display_car” and “display_wall”, the distances are sent by “game_player” and “game_car” respectively

image
image

2 Likes

It looks like its working, where does this happen in the level?

1 Like

If you go around the corner and move so that the wall should be in front, the ball shows in front instead
image

Also, the top left number is the layer of the ball, the top right is what should be the layer of the wall, but it’s not working at all…

Ah okay, my suggestion with this is to shoot a single raycast to the player set to “stop at first object”.
If it can hit the player, then make the use normal display order.

1 Like

danngg this is good

ok so I solved it, the problem was that I just wasn’t sending the info to the display object lol

1 Like