0 votes

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()
       yield(get_tree(), "physics_frame")
       yield(get_tree().create_timer(.01), "timeout")
       prints("side: ", degres, ": connector hash", hash(connectedMatrix))
       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

asked Mar 22 in Engine by NullPointer (45 points)
edited Mar 22 by NullPointer

1 Answer

0 votes

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

answered Mar 22 by NullPointer (45 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.