Still have questions? Join our Discord server and get real time help.
0

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

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.

3
2eggnog 955
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 = CFrame.new(Door.Position - Vector3.new(Door.Size.X/2,0,0))
for i = 1, 18 do
Door.CFrame = origin * CFrame.Angles(0,math.rad(90/18),0) * (origin:inverse()*Door.CFrame)
wait()
end
```
0
That worked. Thanks. Thewsomeguy 448 — 4y