How should I use GetPartsInPart() so it only fires if the part is more than 0.125 studs inside another part?

Hello!
I am trying to fix a problem in my placement system where if two parts are inside each other you should not be able to place the part. I am using GetPartsInPart()
It works fine but the problem is that I only want it to fire if it is inside the part completely. I don’t want it to fire if it is just inside the part with only 0.125 studs as shown in the picture below. I only want it to fire if it is more than 0.125 studs inside the part.

If it is more than 0.125 studs inside the part it should turn red like the parts on the left.
if it is less than 0.125 studs inside the part or outside should turn green like the parts on the right.


Maybe I should use Magnitude inside the for in pairs do? If so how would I do that? Or maybe I should use another way that is not GetPartsInPart()?

I hope you understood what I am trying to achieve here, if you have any questions please ask them!
Thank you for the help.

Hi,

Can I ask what you’re intending to use this for?

1 Like

Without more limits on what you want to happen you would need a signed distance function for each type of part (block, cylinder, etc) you want this to work on. That’s harder than I think you need. Can you explain why you want this behavior specifically? For example if your blocks are never rotated relative to each other this becomes way easier to check.


I don’t want the parts to be able to place inside each other like this. ^

But I do want it to be able to place like this because it looks nicer.


I’m using Attachments in this placement system. The placement system works fine but I just want to make sure the player can’t place parts inside other parts like the first picture.
I hope this helped a little.