I instance a bunch of scenes in a grid inside the main scene. Each scene contains meshes with collisions, defined as a StaticBody3D with a CollisionShape3D child. The player can walk fine on them and all, but there's something else I wish to do: I was wondering how in the script I can check if an area touches any collision from other scenes, for stuff like avoiding overlap in object placement between different tiles? Can I define two Vector3's representing the start and end pos of a cubic / rectangular area and cheaply check if it intersects any collisions in the world?
Detect if area touches any collisions
- Best Answerset by MirceaKitsune
MirceaKitsune you can use the methods get_overlapping_bodies
and get_overlapping_areas
and then tune your logic for what you want to do. These methods return arrays with information on your colliders, dependent of course on if they are areas or bodies.
SnapCracklins Thank you! I will look into it next time I work on the project and add the remaining things. That does sound exactly as what I'm looking for.