<Solved> Area vs Shape collision detection in GDScript at inital phase

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NullPointer

Hi, I try to find a way to detect a template id for a mesh shape for each side.

The plan is to use areas as a grid mask e.g. 5x5 of smal cubes to collidate with a mesh shape on each side to detect a template id.

Like template ‘T’ or ‘L’ to can later combine this meshes by this template id.

I want to calculate this template id’s on game initalisation phase e.g. script construction time.

I implemented a scene where generates the area matrix to collidate whit the shape at _ready()
it works!

Than a have a fuction where have to callculate the template id’s by using a mesh shape (StaticBody + CollisionShape).
I uses signals on each Area to collect the collision of an Area with the shape where collected in ‘connectedMatrix = {,}’

To detect for one side it works perfect, the signals are emidet.

Now my problem
To detect the template id for each side i need to rotate the shape and force the collision detection again.
How to force manually the collision detection?

My workaround is adding and removing the shape for each side detection and i need a wait to let the physics engine detect the collision.
The ‘connectedMatrix’ is filed by signals coming from the areas

    func detectTemplate(meshShape:Node, degres):
      print("detectSide in")
          # reset detected collision areas
      connectedMatrix = {}

       var tmp = meshShape.duplicate()
       tmp.rotate_y(deg2rad(degres))
       add_child(tmp)
       yield(get_tree(), "physics_frame")
       yield(get_tree().create_timer(.01), "timeout")
       prints("side: ", degres, ": connector hash", hash(connectedMatrix))
       remove_child(tmp)
       print("detectSide out")

This looks not so nice and is also not so performant.
The plan is to detect for lots of meshes for each side a template id and should run in the game init phase.

Best Regargd

:bust_in_silhouette: Reply From: NullPointer

I got help in Discord channel and changed from using Area to Raycast and this solves my problem