- Home /
Other
Make projectiles appear over friendly units but not enemy units
I'm making a RTS type game and am trying to make projectiles be drawn over friendly units (so they don't appear to be shooting each other).
I tried to do this using cameras but then either the projectiles are also drawn over enemy units or enemy units are being drawn over friendly units. Is there a way to make it so friendly and enemy units interact normally, projectiles and enemy units interact normally, but projectiles appear in front of friendly units?
Answer by ChristianLinnell · May 13, 2014 at 03:35 AM
It depends what you mean by "make it so friendly and enemy units interact normally". It seems like you want projectiles to go on top of friendly units, but behind enemy units, which implies
Enemy
Projectiles
Friendly
But you also want your friendlies to render on top of enemies? That would put them on top of projectiles as well. What happens when all three are on top of each other? I don't think what you're after really makes sense.
If you do decide on an order, you don't have to use multiple cameras, you can set the material's render queue (use 2001 for the bottom one, then 2002, then 2003. Or if you're using 2D sprites, use the Sprite Renderer component and use the Order in Layer property.
Follow this Question
Related Questions
Axis are in wrong position 1 Answer
TPS Camera keeps moving when I don't move my finger! 0 Answers
Open/Start Device Native Camera in Unity3D app using C# script, Without 3rd Party Plugins 1 Answer
MouseLook Script - Third person Character 0 Answers
Perfomance Optimization for no longer needed objects 0 Answers