Hello, I’m trying to make a door that stops rotation if it reaches a certain angle using Attachments and a HingeConstraint but so far all my strategies are failing. Ideally I want to simulate the “latching” of the door while allowing a slightly elastic restitution when slammed open.
More specifically I’m having issues finding a low cost method for determining the state of the CurrentAngle of the HingeConstraint. I also want to check the current angle for other fun things (like a creaking noise).
I’ve attempted:
hinge:GetPropertyChangedSignal("CurrentAngle"):Connect(OnMoving)
- results: failure, no response from OnMoving function
I’ve also attempted
hinge.Parent:GetPropertyChangedSignal("Orientation"):Connect(OnMoving) -- the parent part
- results: also failure
I’ve read here about hitchhiking on the heartbeat to evaluate the angle but it just seems a little too costly. If you have any suggestions for a different approach, whether it’s adding springs or different code, they would be much appreciated.
Thanks for the help.
EDITS:
I have an idea, maybe I can use a touch connect to set the restitution. Will try later…