Ad
Log in to vote
0

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

Asked by 3 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
3
Answered by
2eggnog 925
3 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 445 — 3y
Ad