Home > other >  How to judge whether an area have Colider2D object
How to judge whether an area have Colider2D object

Time:09-18

A few days ago I learn the A * algorithm, but A very egg pain problems:

how to determine whether an area have Colider2D object
Or: Physics. 2 d how at one location assumes a rectangle to detect collisions with the surrounding

Specific situation I encountered:

Identify obstacles when baking grid, online general method is to use Physics. The CheckBox to detect - on the assumption that there is a cube is a place with the surrounding collision detection,
OK, but I this is 2 d, early all prefab is set according to the Sprite, and there is no corresponding method Physics2D,
I want to come to a roundabout way is to use ray detection, but the feeling is performance,,,

CodePudding user response:

AABB algorithm under reference

CodePudding user response:

The separating axis theorem can be used in detection, if around obstructions is concave polygon is to divide it into several convex polygons to detect,
Portal: https://blog.csdn.net/yorhomwang/article/details/54869018
  • Related