0 votes

I just added CollsionShape and Area to the voxels (3D tiles) of my games. I create the Area with generate_faces and create a signal to dectec de mouse_detect_area:

func generate_faces():

    var surfaceTool : SurfaceTool

    surfaceTool = SurfaceTool.new()
    surfaceTool.begin(Mesh.PRIMITIVE_TRIANGLES)

    for i in range(VOXELDATA.voxelFaces.size()):

        if notNeig[i]:

            for j in range(VOXELDATA.voxelFaces[i].size()):

                surfaceTool.add_vertex(VOXELDATA.voxelVertices[VOXELDATA.voxelFaces[i][j]])


    surfaceTool.generate_normals()

    mesh = surfaceTool.commit()
    meshInstance.mesh = mesh


    bodyShape = mesh.create_trimesh_shape()
    collisionShapeBody.shape = bodyShape
    add_child(collisionShapeBody)


    areaShape = mesh.create_trimesh_shape()
    collisionShapeArea.shape = areaShape
    area.add_child(collisionShapeArea)
    add_child(area)

    area.connect("input_event", self, "_detect_area") # self is the StaticBody that contain the Area


func _detect_area():
    print("Collision detected")

Although CollisionShape and Area are created in the same way, CollisionShape are working, since I tested with a falling RidigBody; but Area is not, nothing appears in the Debugger when I click the voxels. I add an image with the scene and the scene tree: here

I tried to move the ┬┤Area┬┤ outside the chunk using Remote option to chech if there was some problem, but it is still not working.

Godot version 3.3
in Engine by (225 points)

Please log in or register to answer this question.

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.