Still have questions? Join our Discord server and get real time help.
Log in to vote

Making a door swing open/close smoothly? [closed]

Asked by 4 years ago

How would I make a door swing open or close smoothly? I'm thinking I would have to use the rotate edge formula, but I don't know that.

Locked by Thewsomeguy and BlueTaslem

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
Answered by
2eggnog 955 Moderation Voter
4 years ago

Since this has been asked before, I'll just copy and paste my answer from another question.

Here's how you rotate a part around a point (or in your case, a door).

part.CFrame = origin*rotation*(origin:inverse()*part.CFrame)

origin is the point (CFrame, not Vector3) you're rotating around, and rotation is the CFrame you're rotating by.

You can use a simple for loop to make it open smoothly.

local origin = -,0,0))
for i = 1, 18 do
    Door.CFrame = origin * CFrame.Angles(0,math.rad(90/18),0) * (origin:inverse()*Door.CFrame)
That worked. Thanks. Thewsomeguy 448 — 4y