[RESOLVED] Detect mouse over 3d object

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

I have a 3d mesh and I want to detect mouse overs. So I added an Area with a collision shape and a mouse_entered() signal. “Input Ray Pickable” is true.

But none of my collision methods are firing.

func _on_ManufactoryArea_mouse_entered():
	print("mouse entered")

func _on_ManufactoryArea_mouse_exited():
	print("mouse exited")

func _on_ManufactoryArea_input_event(camera, event, click_position, click_normal, shape_idx):
	print("input event", camera, event, click_position, click_normal, shape_idx)

I don’t have to raycast the mouse location do I? I assumed Godot would handle that given the mouse_entered signal is inbuilt.

:bust_in_silhouette: Reply From: Andrea

does the 3Darea have a collision shape?

Yeah, of course. Ok, I just replicated this in a test project and it picked up the signal which it’s not in my actual game…

Um. The game uses numerous viewports for minicameras but not when the game starts though. Otherwise the Area node in buried quite deep in an obj. I’ll try adding a test obj into the game. Other than that I’m at a loss.

DaddyMonster | 2021-01-07 13:59

not really an answer, but start from the test project and keep adding your game features, you’ll find a which one is causing the issue eventually

Andrea | 2021-01-07 16:02

Appreciated. I restarted the editor and now it works. Nobody suggested “turning it off and on again” :wink:

DaddyMonster | 2021-01-07 17:25

:bust_in_silhouette: Reply From: derHinek

I had the same problem, in my case it was due to a Control node in the scene.

I had a Control node with Label subnodes in the scene to work as a HUD. As soon as I removed it or just made it invisible, the Area input_ + mouse_ signals were working. When I made it visible, they didn’t work anymore.

The Control node blocked the mouse from the objects behind it. I had to set Mouse → Filter to “Ignore” for the Control node, after that everything worked fine.