Prismatic Constraints: ReachedLimit(Upper/Lower) Event

I am using prismatic constraints to make lifts in my game, they are incredibly useful. However if I want to add sounds to the lifts, I will need to do a loop check to see if the prismatics constraints CurrentPosition property is =<LowerLimit or =>UpperLimit (>< due to some small extensions beyond limits.)

Current Method;

  • Activate the lift
    – Play Looped sound
    – Change the prismatic constraints velocity
  • Create a loop/renderstepped check that watches the CurrentPosition property of the constraint and use that to determine if the lift has stopped or not
  • Deactivate the lift
    – Stop looped sound
    – Play lift arriving sound
    – Change prismatic constraints velocity
    – Additional functions

It would be really helpful if rather than set up a loop everytime I wanted to play a sound, I could instead just hook up an event that listens for when the lift has stopped moving. It would make it look more like this

  • Activate the lift
    – Play Looped sound
    – Change the prismatic constraints velocity
    – Create a .connect:ReachedLimit() for the constraint.
  • ReachedLimit is fired
    – Deactivate the lift
    — Stop sound
    — New sound
    — Change velocity
    — Additional functions

This is just one use case, but there could be plenty other potential uses.

25 Likes

Having these events is definitely a good idea. Let me increase the priority on this task.

15 Likes

I made a similar topic a little while ago with additional use cases. It would also be awesome if we could get something similar for the HingeConstraint object. I’d really love to see these events get added.

2 Likes

Is this still being looked into? It’s been about 2 years and I still find myself needing this, as well as the AngleReached one Zomebody posted. Constraints are lacking some significant functionality and this is one of the couple major things it still needs IMO

AlignPosition & AlignOrientation should also get a “ReachedGoal” event (if that’s feasible and not messy).

7 Likes

@Khanovich @kleptonaut

Is this reasonable? This is still causing issues and and would be fantastic to have. What do you need from developers to push this forward?

We have a similar use case in Robloxian High School as the OP - we have a car lift in one of our purchasable mansions and we have to run code on RunService.Stepped to check if the lift has reached the top or the bottom. This would be much easier if we had an event to listen to.

This is a good feature request and we should do it, sorry it’s been neglected for so long! It’s officially on the list now :slight_smile:

12 Likes

Any word two years later? Also would be helpful for other constraints.

1 Like

Any updates on this feature? I could really use it.

That must be a crazy list, considering roblox staff has stated they were going to “increase the priority” 6 years ago, and “added to the list” 3 years ago…

2 Likes

Would love to see this. I use PrismaticConstraints for pressure plates in one of my projects and I ended up just checking it in Heartbeat, events would be so much nicer for this.

Any update? This would make constraints a lot more useful.

1 Like

Its kinda hacky, but using something like math.ceil(CurrentPosition) == math.ceil(LowerLimit) worked for me

So basically from what i know;
The PrismaticConstraint let parts slide along an axis but no rotation. putting it to None will let it move freely. Changing it to Servo will allow the parts to move to a certain position.
TargetPosition is where the PrismaticConstraint moves the parts to.

On the other hand, the HingeConstraint is for rotation.
There are 3 modes.
None: Allows free rotation
Motor: makes the part turn (no servo)
Servo: basically makes the hinge act like a servo motor.

If that’s hacky, maybe we could just compress it into a variable. But that would just add an extra step… Or we could do something like ReachedLimit(instance) and return true/false.