Detecting When Player Clicks Constraint

For a building game I’m working on, players can place constraints between parts. Is it possible to detect when the player clicks a constraint, such as a RopeConstraint or a spring?

This is so the player can select a constraint and edit/delete the constraint

I noticed there’s no input property for clicking on constraints, and Mouse.Target doesn’t detect constraints

You could create an invisible part that can acts as an hitbox that takes up the space between the two two parts attached to the constraint. Then add a DragDetector or ClickDetector and then detect clicks on that.

1 Like

I’ve thought of that, but imagine a SpringConstraint that looks like this:

image

The invisible part as a hitbox would be huge, and also you wouldn’t be able to click between the gaps in the spring since the hitbox part takes up the entire space between the parts. Also, I’d have to constantly update the location of the part hitbox every frame if one of the parts is unanchored, since the spring would be moving around instead of staying in once place

This wouldn’t be good for performance, especially if there’s several players in game who have hundreds of constraints on their base