I’m wanting to create a decal system that functions in the same way as Half Life 2, or any other game that has decals in it. The best example of this I can find is this video of Roblox World War 2, by @orange451.
Not sure how he obtained the effect, where the bullet holes don’t go off the part, as mine does currently. Any tips and tricks on this would be greatly appreciated.
That’s a good question. Not entirely sure how it works but as long as it is a Roblox mesh like a ball of cylinder, it should work. If you want mesh parts I recommend separating them in blender or C4D and using Roblox shapes to your advantage, you might just pull it off if the mesh is the same shape as the Roblox part!
Scale the GUIs with offset instead of scale. You might also need to dynamically adjust the CanvasSize of the SurfaceGuis. I guess you could make it smaller the larger the part or something.
EDIT: Sorry I see what you want to do. I’m bad at math but I think you could compare the part’s position with the size of the part to make the effect on. If its position is larger than the part’s size on a certain axis, resize it by that amount? Something like that.
Summary
If you position and scale the SurfaveGui correctly it should give you the effect you want. It should be as simple as making a new SurfaceGui on the part you hit and then making positioning the effect at the spot it’s supposed to be. With ClipsDescendants true it will cut off what’s outside of the part.
Does his properly clip with terrain and meshparts too? The only way I can think of doing this is having those be handled differently and not be clipped, while shots on regular rectangles do get clipped (to an extent)
It’s the kind of thing you’ll probably have to make compromises on if you want it to be performant
What would be even better than above though is if you used a part (optionally with a decal) and using a cross product to make the hole appear flush with the surface. This is what I would assume the system you’re talking about uses for meshes and terrain. The wiki had an amazing tutorial on how to do it but unfortunately it seems to have died due to the push from the wiki over to the devhub
We do have that article on our server, but it’s currently shelved due to broken images.
The article was originally written by @EgoMoose. I’d be happy to restore it if he has the original images.