0 votes

I'm trying to make a puzzle where you have to align the red marked zone on top of each circle, but I'm having trouble detecting mouse inputs on each circle. So basically I have a scene like this:

Node2D (parent)
|-- Kinematicbody1 (Big yellow cirlce)
|-- Kinematicbody2 (Medium blue circle)
|-- Kinematicbody3 (Small magenta

each of these kinematic bodies are seperate scene, if you put them together they look like this. Now I'm having trouble detecting mouse inputs on each of them, since they are stacked to one another the yellow circle detects the magenta one whenever I clicked it, I use the inputevent from the collisionobject2d. I wanted each of these circle to detect mouse input seperately from one another since I'm going to rotate them. This may seem simple but I just... can't seem to figure it out. :(

Godot version 3.5
in Engine by (15 points)

1 Answer

+1 vote
Best answer

Make the parent Node2D handle all of the logic for figuring out which circle was clicked.

if smallest_circle_center.distance_to(mouse_input) <= smallest_circle_radius:
    #smallest circle clicked
elif medium_circle_center.distance_to(mouse_input) <= medium_circle_radius:
    #medium circle clicked
elif large_circle_center.distance_to(mouse_input) <= large_circle_radius:
    #large circle clicked
by (3,882 points)
selected by

Thank you!! It never occured to me that you could just calculate the distance between the mouse clicks and the kinematic bodies, I think I was too tired for staring at the screen for so long :')

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 Frequently asked questions and 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 [email protected] with your username.