- Home /
Bullet (Splat) Marks Overlap edge of GameObject
Hello all,
I have run into an issue with my splat marks overlapping the edge of the objects that the projectile collides with (I use Raycast but is easier to put that way).
See screenshot
Does anyone know of a simple way of making them wrap round corners or of another solution.
Thanks.
This is probably too vague -- how are you making your marks? Is that some flat object sitting in the space?
Yes its a quad thats positioned using the position and normal of the object hit in the raycast of the trajectory of that projectile.
Answer by JonPQ · Feb 04, 2019 at 10:37 PM
This is not simple to solve, you either live with it, use smaller decals... or calculate polygons to project on to and duplicate the geometry. You can also make decals using UNity's simple blob projector, but it will also project onto sides of objects and objects behind... and isn't too fast if you want a lot of decals.
You are probably better off buying something from the asset store, that can can calculate intersect polygons properly, and draw all decals in one draw call. something like this... https://assetstore.unity.com/packages/tools/advanced-bullet-decals-63202 but please look at all options available carefully, some have the same problem you have.
Thanks, I'm am trying to make this without using outside assets (I do realise I'm making it harder for myself but find its the best way to learn), also I am currently looking at using an L shaped plane and corner plane made in blender to get round this, do you know of any pitfalls to this method before I get too far along?
if you are only using right angled corners. on your walls then there are a few different workarounds you could try.... so you might still have same problem at ceilings and floors, but lets ignore those for now and just do walls and corners... you'll need 2 scenarios, inside and outside corners (convex and concave)
I think best to make things work with 1 polygon first. so it can clip itself at corner.
If you don't $$anonymous$$d not wrapping around corner... just do one plane, (not L shape) shrink the plane to stop at the corner, then set your UV's to clip the texture appropriately... still some tricky math.
first you'll need to deter$$anonymous$$e IF your bullet hits more than one polygon... to deter$$anonymous$$e a corner. so after the first raycast... you may need to do a few more at the corners of your decal, to deter$$anonymous$$e if all impacts have (roughly) the same collision normal (same flat surface) If not.. you'll need to calculate the corner position to clip your polygon.
re:- wrapping round corners.... I think it might be easier to use flat plane rather than L shape... and place 2 of them... one on each surface... but then clip geometry, and edit the UV's on each plane