Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Easiest way to check if two parts are overlapping?

I'm trying to design a hitbox mechanics where the moment a player attacks the game generates an invisible part with no CanCollide. If this part is overlapping the hit area from another player (an invisible part, covering the body), the game will count that as hit. Is there any way of detecting if a part is touching another without writing a whole code of vectors and algorithms? (Sorry for my english)

2 answers

I see you got your answer but you could also use magnitude that could complete a similar tasks. Magnitude gets the distance between 2 Vector3's. You could find the distance between the weapon hitbox and the enemy hitbox. I think magnitude is very helpful in a huge variety of problems so you should still read about it :) https://developer.roblox.com/en-us/articles/Magnitude

2 comments

0

Thanks, but Magnitude is only useful for spherical hitboxes

0

Yeah I forgot about that. I guess magntiude wont work as well

This discussion is preserved as it was. New answers, comments, and votes are closed.