0 votes

I'mm designing a squared tiled map in 3D. To know the translation of each tile, I want to use a CollisionShape and an Area to print that vector when clicked.

In the experiemental/test scene, it seems to work, but not in the main scene of the game. I put a video here so you can see what I mean: YouTube video

Here I put the code of the tile:

extends Spatial


func _on_Area_input_event(_camera, event, _click_position, _click_normal, _shape_idx):
    if event is InputEventMouseButton:
        if event.button_index == BUTTON_LEFT and event.pressed:
            print(translation)

I forgot to show in video, but in Remote, all the CollisionShapes are in the right place and have a Shape:
enter image description here

The only node that uses inputs is the camera I created, but in the proof scene everything works fine.

Godot version 3.3.3
in Engine by (225 points)
edited by

1 Answer

0 votes

Have you checked if your collision layers/masks aren't set up wrong? I had a similar issue and my layers/masks were the problem.

by (177 points)

First time I've heard about collision layers/masks. I found this link for documentation. But not sure how to solve it. Area layer and mask is set to 1. Not sure if the mouse have different mask.

Well, if you haven't tampered with the layers/masks then that's not the root of the issue. It might've been the root if you HAD changed them, but since you haven't...

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.