Ability to detect when a constraint with limits enabled has reached the limit?

I couldn’t find a post asking this, sorry if it was asked before

What is the simplest way to detect when a constraint reaches its limit? (with limits enabled)
I searched on the documentation page but there was no event similar to .changed or .touched and I don’t think checking the constraint’s attachments every second to see when they are too far apart is efficient since there would probably be a lot of constraints all running on the server
I want to know when the limit is reached (or at least a similar alternative) so that a constraint’s parts can move freely within its limit but when the limit is reached it breaks

examples: Ball socket constraint turning to X degrees and breaking, hinge constraint reaching its limit angle and snapping

Do I have to just constantly check the attachment points every so often in a script or is there a cleaner solution?

I’m not very knowledged on this but try using :GetPropertyChangedSignal(“property”). (Sorry if this wasn’t what you wanted)

Yes, you have to do your own checks, either periodic polling, or using property change listeners. Some of the constraints have read-only properties to get their current position or angle, etc. There are no limit-reached events, or anything like that, as they would simply fire way too often.

You also have to code defensively against parts going to sleep. If some constraint is slowly, asymptotically approaching its goal, it might sleep before it reaches it.

yeah dang thought so
might have to ditch the idea if it looks bad/laggy in the end but ill try, thanks for the reply

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.