- Edited
Hello, I have Area2Ds in my scene that get highlighted when I hover over them, and a HUD that covers the screen. When I show the HUD I disable the highlights, and when I hide the HUD I want them to appear again, but MouseEntered doesn't get fired on the areas this case. I have to move my mouse outside of the area and back in for the highlight to appear again.
I dunno how to find which area my mouse is on top of so I can highlight it when I hide the HUD. They're not rectangles, so I can't just use a simple Rect2.HasPoint().
This describes the same problem:
(I haven't tried the first answer, it sounds a bit hacky and I would rather get this to work...)
public override void _PhysicsProcess(double delta)
{
PhysicsPointQueryParameters2D _params = new PhysicsPointQueryParameters2D() {
Position = GetGlobalMousePosition(),
CollideWithAreas = true,
CollideWithBodies = true
};
var hits = GetWorld2D().DirectSpaceState.IntersectPoint(_params, 5);
GD.Print(hits);
}
I'm not sure where it's supposed to go, I tried adding it both to the Area2Ds and to the root node, either way I get an empty array.