Overlapping Models

So I’m having trouble with overlapping models. I can’t really use Unity’s built-in collision due to the nature of the game as it picks up, so I have my own little collision that basically tries to bounce on collision but isn’t extremely strict to prevent twitching/spazzing characters.

Anyways, is there a way for me to make the clipping a little less awkward? Right now, it seems like it randomly will show parts of some characters. Like in the attached screenshot, part of the blue and red characters don’t show up when overlapping. Is there a way to make it always show one entire character over another without changing the x,y,z coordinates?

Preference towards making newly spawned characters have rendering priority over older (or vice versa), or even making one color have priority (they are the same models, just different materials)

Thanks!

1121366--42302--$Screen Shot 2012-12-28 at 10.55.44 AM.png

This might be what you’re looking for? Material.renderQueue

At the shader level: SubshaderTags

I’ve tried both of those, and neither seems to change anything.

I do know it is changing, just the camera doesn’t seem to care about the numbers.

I basically have a script that spawns the characters, and I just kept incrementing a number and setting the renderQueue to that value on spawn (so the oldest spawned character has the lowest number), but there was still noticeable clipping. Not even sure if it changed at all. To test, I made a script that basically printed the renderQueue number of the gameObject I clicked. And the number was definitely changing.

And I had previously tried changing the subshader tags, but to no luck as well. Maybe I’m missing something though.

You might want to take another look at the built in collision detection. If you aren’t using colliders at least for your collision detection, you may run into performance issues if you intend to go to mobile devices.

You can still use colliders as triggers even if you choose not to use the physics system.

I’m still using them as triggers, I’m just not letting Unity handle what to do during collisions. For some reason, I would have objects randomly decide to phase through walls or other objects, so I decided to just script boundaries.

Plus, I didn’t want them guaranteed to bounce or anything, because later in the game, the spawn rate increases and I did not want a bunch of twitching or the possibility to block off a spawn point/exit.

The only thing I want to fix is to have the camera render one complete object over another, instead of having them clip and show only parts of both.

Think of it like in a 2D game, where the sprite with the most recent draw call is placed on top of the other sprite and part of the bottom sprite might still be sticking out.

I thought render queue or shaders would solve it, but for some reason, it doesn’t appear to change anything. My spawner set the render queue: