There are hitboxes in the form of a rectangle. they can rotate and move.

How to search for "collisions" of these rekthangles?

    1 answer 1

    Perhaps in javafx there is such a function intersects. Here is an example:

    //Создаем хит-боксы Rectangle playerHitBox = new Rectangle(...); Rectangle enemyHitBox = new Rectangle(...); //Проверяем на столкновение if (playerHitBox.intersects(enemyHitBox)) { //Дальше реагирование на это столкновение } 
    • Yes, right .. you can. The question is old, the problem is solved. - Max
    • solved by: 1) check for the intersection of rectangles. if it is -> 2 2) we check the intersection with the hitbox (set of lines) 1 action will protect against heaps of unnecessary checks. but will not give 100% accuracy due to changes in the size of the rectangle when turning. - Max