So when I was making a module for placing paint/blood splatters on ground, walls and ceiling I’ve came to a small problem I have no idea how to even approach.
So when a paint/blood splatter is placed near a brick’s edge, I want to wrap it around the edge or cut off that small piece that is not placed on the brick.
I would preferably have this work for all bricks (wedges and corner wedges too and if possible, meshes).
In my current code I just do a raycast and use it’s surface normal to rotate parts and such.
What are the best ways or solutions to this problem?
A difficult idea to approach, what have you tried?
Personally I would split the blood into two halfs, and then raycast a center for general position, a second one for the first half of the blood and rotate it accordingly and then a third one for the second half and rotate it accordingly. If the place to set the blood is too far, just dont spawn the half.
It’s important to understand that blood spatters dont really wrap around edges, and tbh in Roblox blood spatters are generally avoided.
I haven’t really tried anything yet.
I was thinking about using surface guis but have no idea how to even start and surface guis only work for block bricks and not for wedges and such.
About the 2 splatter halfs.
I’m not sure how that would work either.
Then you would have to do a lot of raycasts I thought.
multiple raycasts next to each other, but how do you detect it’s near an edge in the first place and how do you know if the second raycast would have to be left, right, up or down?
Phantom Forces had this one smart trick that, if a blood (or paint if painball game) splatter would be near a edge, they make it smaller so it wouldn’t clip off the edge.
But how is that simply done?
If they are anchored, and do not overlap, it will be the same effect. Just remember to despawn blood splatters after a while or you will lose a ton of memory the longer the server lasts.
Just do not overlap 100s of parts, use like 10-15 small parts.
I was actually thinking of having it all client side and just have the server tell the client in what direction to spawn the splatters and use math.randomseed() and such to generate random splatters that are simular to each other (assuming math.random is the same for everyone if the same seed is used).
When on client, splatters could stay longer or be more detailed depending on client’s personal settings.
To make it look more realistic and dynamic I was thinking of
splatters placed on anchored parts stay anchored
but when placed on moving parts they will be unachored and welded instead.
(dynamic/moving splatters would despawn earlier than anchored parts since they require slightly more work as they are moving.)
Yeah, I meant on the client. Just let the server send the client what positions and rotations to put the parts at. Also, you will still have to despawn splatters after a bit, server or client. They will both get pretty laggy over time if you do not.