Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Easiest way to check if two parts are overlapping?

Asked by 3 years ago

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

Log in to vote
0
Answered by 3 years ago

Nvm just found this

https://developer.roblox.com/en-us/api-reference/function/BasePart/GetTouchingParts

Ad
Log in to vote
0
Answered by 3 years ago

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

0
Thanks, but Magnitude is only useful for spherical hitboxes masterjosue1998 116 — 3y
0
Yeah I forgot about that. I guess magntiude wont work as well JustinWe12 723 — 3y

Answer this question