Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Rotating a part on its edge?

Asked by
wackem 50
8 years ago

I have no idea where to start for this except for a basic rotation script, but I don't know how to make it rotate on an edge so it does not rotate from center. (i.e. swinging open doors.)

This is all I have:

local b = script.Parent
local rot = 0
local db = true

b.Touched:connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") and db then
        db = false
        for i = 0, 45 do
            wait()
            rot = rot + .04
            b.CFrame = CFrame.new(b.CFrame.X, b.CFrame.Y, b.CFrame.Z) * CFrame.Angles(0, rot, 0)
        end
        wait(2)
        db = true
    end
end)
0
I guess if you really wanted, you could do a lot of math to change the CFrame position of the door to make it appear to rotate on the edge, but that's a crazy amount of work. GoldenPhysics 474 — 8y
0
well is there a simpler way? wackem 50 — 8y
0
You can use hinges, but that doesn't require scripting. Decemus 141 — 8y
0
hinges arent very reliable wackem 50 — 7y

Answer this question