Closed MindVisceral closed 7 months ago
Checking for nearby Interactables every frame may be a neccessity because of the highlighting system. Verifying...
I was making dough for pizza, so I wasn't actually looking for this for an hour btw, but I found out that ray_pickable may be used to highlight objects that are hovered over by the mouse instead of a raycast. This would decouple the mechanical system (actual interaction) from the visual system (outlining objects).
The limitation of this system is that it only works in First Person, because it won't look quite right, but that shouldn't be an issue. If it works for the source engine, it will work for me.
Alas, ray_pickable breaks when the mouse is set to Input.MOUSE_MODE_CAPTURED. Looking for a fix or a workaround...
Indeed, ray_pickable is disabled when the mouse mode is set to MOUSE_MODE_CAPTURED. This is a known issue since 2019, but no one bothered to fix it. Twats.
Instead, a permanent RayCast may be used just for this system alone. We'll go with that.
On 2024.02.15: The Interaction system seems to have been sufficiently rewritten.
Now it consists of a single Interactable Area3D and an InteractableCast as a child of the Player, which detects Interactables. Unfortunately, to allow for interactable object outlines, this system couples interacting with outlining. Though thi shouldn't be much of an issue.
Either way, this is enough to close this Issue and go back to #26 and make this system at large better.
Whilst working on DuckGame, it came to my attention that the current implementation sucks a little. The Player should only check for Interactables within range when the input_interact button is pressed; There is no point in checking for Interactables every frame.
And yet, a secondary Area3D was added to nullify that issue. It didn't achieve the desired results, and it turned out to be annoying to set up when designing the game and its levels.
Redesign proposal: -Check for nearby Interactables on Input (input_interact button) -The Interactable Node should only consist of a single Area3D Node and its CollisionShape3D