- Home /
2D topdown combat collider vs OverlapBox etc...
I'm working on my first game which is top down zelda like action rpg. I've been looking into how to handle attacking. So far I've found two approaches: create Collider2D
s for the attacks that start disabled and turn them on when attacking or using Physics2D.OverlapBox
and checking for hits when attacking. I've prototyped both and got them working, but now I'm trying to decide which path to go down. Hoping someone with more experience might be able to help me understand the pros and cons between the two systems or maybe point me in another better direction. Any advice more than welcome!
@hexagonius thanks for the advice! Quick follow up... while I see its cleaner to do the Overlap I did like the way the BoxCollider was easy to visualize in the scene editor. Is there a simple way to visually represent where an overlap is when debugging?
You can easily use Debug.DrawLine 4 times to show that box.
Answer by hexagonius · Aug 26, 2017 at 05:27 PM
I recommend not bothering about these. They're easily interchangeable. The main reason for the OverlapBox over the constant trigger is basically when you just want to check the overlap once in a situation where you usually wouldn't want to carry colliders around all the rest of the time. By this I mean every hit with a sword is not often, so overlapbox is ok. It's cleaner than toggling a trigger. A trigger could also lead to later problems when the hierarchy gets bigger and it registers hit in it's parent rigidbody gameobject if it has any.
Stick with it, there are bigger problems in the future to solve.
Your answer
![](https://koobas.hobune.stream/wayback/20220612133611im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Help with 2D topdown combat 1 Answer
When should I use tilemap and game object? 1 Answer
Attacking Enemies at an Angle 0 Answers
How to get an enemy to go to a location and then return.,Hi, 1 Answer
how to make multiple save point in one scene and load the latest save point in another scene? 0 Answers