Keep parts within the edges of parts

I have a game where the player is able to shoot paint out of a gun and the paint splats onto whatever surface the projectiles hit. However, if the projectiles hit too close to an edge they will hang over the edge and if there are two parts adjacent to one another the paint will be angled incorrectly like below:

What I want to be able to do is detect whether these parts are not fully on a surface and if not move them so that they stay within the area of a part’s surface, so they don’t stick out like that. This causes issues because the paint has CanCollide set to true so they get in the way when the player is moving, plus they look really bad. I’ve tried looking up solutions but couldn’t find anything similar to this issue.

Any ideas on how I can keep them within the edges of a surface?

1 Like

Check out this thread from 2017.

You’re probably going to have to tweak it, since you’re dealing with parts with an orientation other than (0,0,0)

alright, thanks. I’ll experiment with it and see if I can get it to work!

1 Like

Correct me if I’m wrong, but don’t Region3s only return parts if the part’s position is inside the region? If that is the case then this won’t work properly because if the part is hanging over the edge the position could be outside the region entirely.
I’m not too sure how I would use a Region3 altogether to be honest. Wouldn’t it only return valid objects? How do I target only the overhanging parts?

I’m confused as to how to do this. I want to make sure that there is a surface under the paint that is equal or larger than the size of the paint itself and that none of it hangs over, and if it does I want to move it within those bounds

Sorry for the very old bump, but I was curious if Crowdsource’s solution worked for you? Attempting something very similar and I cannot figure it out for the life of me haha.