Get_overlapping_areas() problem

Godot Version

4.3

Question

Hi all, I’m creating a building system, and I’m using the len(get_overlapping_areas()) method to get the collision count of objects. Everything works fine, but when moving the mouse quickly (the object moves behind the mouse), collisions are not detected in time and the object is built on another. Is there any ways to fix this, or should I use another faster method. It works even worse with signals. Thanks in advance.

Всем привет, я создаю систему строительства, и использую метод len(get_overlapping_areas()) для получения кол-во коллизий объектов. Всё работает нормально, но при быстром перемещении мыши (объект двигается за мышью), коллизии не успевают обнаружиться и объект строится на другом. Есть ли способы исправить это, или мне использовать другой более быстрый метод. С сигналами работает всё ещё хуже. Заранее спасибо.

Use raycasts, as areas are no good for very fast moving objects.

1 Like

thank you. But I have another problem, I set up raycast 2d and made several rays in different directions, but if an object goes inside another more than halfway they stop working

Try enabling hit_from_inside.

1 Like

Thank you. When moving the mouse quickly, objects are still stacked on top of each other, but much less frequently. I wanted to try to change the mouse speed in the game, but I haven’t found a normal way that works for me.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.