How should I go about rotating this door?

I want to turn this door into a functioning door that you click the lock part and it activates a script to rotate the door open/close.
https://gyazo.com/a6bd43bef8f4af2676305ceec61d60ba

The issue is, simply rotating it rotates it into the center of the gate. Is there some way I can like create an anchor/origin point so that when I rotate it rotates properly? If you get what I mean. Thanks.

You can use the new Pivot system that roblox introduced. In the studio topbar, select Model >> Edit Pivot. Then, move the pivot where you want the model to rotate. Once done, you can use model:PivotTo(model.WorldPivot * angle) to rotate the model.

If you want to make the model physics-based instead of CFrame-based, then you can add an invisible cancollide false part that acts as a hinge. Then, add an attachment onto it and another attachment on the parts that will move. Weld the parts that will move together and unanchor them. Finally, attach a HingeConstraint into the hinge part and attach the connections. You may have to rotate the attachments to get the hinge constraint to work.

Capture

It looks like you’re making a prison door. HingeConstraints have an optional LimitsEnabled property that you could use to lock the door by setting the angles to 0 (depends on rotation).

https://gyazo.com/ff663dabbd7591463b1ed25dbed07c5e am I blind? Can’t seem to find it? Thanks

You have to enable it in the beta settings. Just go with an attachment system that i’m writing up.

1 Like