Any way to cut/wrap paint/blood splatters around edges of bricks?

Hello, RubyEpicFox here.

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?

1 Like

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?

You could take smaller bits too, and ray cast to see how it would splatter. There are many ways to approach this.

Do you mean as in do like 4 - 8 raycasts and spawn in small 0.2 - 0.5 cylinder parts to make it look like a splatter?

I’ve thought about that before but thought that it would be a little expensive possibly.

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.

Just asking out of curiousity.
Is math.randomseed the same for every client - server?

So doing math.randomseed(1) on both client/server will
always make the first math.random(10) > 3 for example?

Also if I used math.randomseed() in a other script, will it affect all scripts?

I need to know this for my splatter script as well to be sure all clients will have the same platters.

I’ll try a few of the solutions posted here.
I’ll be sure to mark it as a solution if it works well enough for me.

(Also, could someone answer the question about randomseed? I know it’s slightly off-topic but would really appreciate if someone told me.)

hello, I recently created a module for you. unfortunately you will have to use images instead of meshparts

1 Like