How would you have a model "slide" underneath the tilemap?

I’m trying to figure out how to make a model slide underneath the tilemap I’m using. I have a predicate for a model which exists always underneath it and I have a model which always exists above it. However, what if I want a model to “collapse” by reducing the Z value into the tilemap floor? If I simply adjust the Z value then the object is still visible since it’s in a later predicate. I’m thinking about using a stencil buffer to achieve this, but I would prefer to reserve the usage of this until later since I might want to add some raytraced based lighting to the game.

One approach could be to set the camera bounds where the floor is, which would clip the model if moved below it. The tricky part is to keep the second model underneath the floor visible, not sure how to “have the cake and eat it”.

1 Like