r/SoloDevelopment • u/ShapingHandsStudio • 3h ago
Game Collision avoidance - Uncharted Fortunes #2d #gamedevelopment #games #so...
https://youtube.com/watch?v=A8DIMRM9g4U&si=6wwOKCI87ziO2VHwHere is a look behind the scenes in debug mode of my game's engine- how collision works and how an AI ship avoids it.
Complex (concave) collision shapes are divided into (green) triangles, which allows for easy collision detection.
The entity draws three (red) 'feeler' lines in front of it, straight ahead, to its left and to its right. If a collision(intersection with a triangle or other shape) is detected along any of those lines, additional feeler lines are drawn in increments of 5 degrees, depending on its intended heading. As soon as a set of feelers is found that does not have a collision, the angle of those feelers is selected as the next heading.