0 votes

For some reason, my mouse_entered() only emits when the scene just starts up. This is what my scene tree looks like.
Scene Tree

I'm unsure if there's something that needs to be changed somehow. The following is my code for handling the signals.

extends RigidBody

export var obtainable = true
export var quantity = 1

var mouse_over

signal picked_up(object, obj_quant)

func _input(event):
    if Input.is_action_pressed("pickup"):
        print("pickup attempted")
    if mouse_over and Input.is_action_pressed("pickup"):
        print("picked up")

func _on_Selection_mouse_entered():
    mouse_over = true

func _on_Selection_mouse_exited():
    mouse_over = false

My pickup input works fine and it is running. It's just the mouse_entered() and mouse_exited() that are not working. Here are the signals from the Selection Area node.
enter image description here

in Engine by (15 points)

1 Answer

0 votes
Best answer

Your RigidBody node could be intercepting the mouse_entered() and mouse_exited() signals; check to make sure the node isn't capturing the signals.

by (2,080 points)
selected by

So it looks like it switches between the RigidBody and the Area nodes. How would I solve this if I wanted to have a separate Area for the selection hitbox?

The input_ray_pickable property of the RigidBody may have to be toggled on and off when the mouse enters the Area. Either that, or make the CollisionShape of theArea larger than the CollisionShape of the RigidBody.

Ahhh. I didn't think of turning off input_ray_pickable on the RigidBody. The problem persists if the Area shape is larger than the RigidBody shape. Thank you so much for the help!

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.