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

in Engine by (46 points)
edited by

1 Answer

0 votes

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

by (46 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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.