I am trying to make a door that opens when you touch it, but I want it to rotate from the edge of a part instead of the center of the part if that is possible.
How do I rotate from the edge of a part instead of the center position of a part
Actually heres a better link https://developer.roblox.com/en-us/articles/CFrame-Math-Operations#rotating-a-door
Why can’t find the surface property in the part’s properties so I can put a hinge on it, but I can find it in the baseplate?
Roblox is in the process of deprecating hinges and motors if im correct.
that is strange though, I wonder if it’s intentional
But the hinge constraints don’t have a cframe property, which means you can’t do anything with them?
Surfaces hinges never had a CFrame afaik
So how am I susposed to make a door then?
You could probably rig it up with constraints (and I recommend that if its an option). If you want to set cframe directly though you could do something like this:
local door = workspace.Door local hingeOffset = CFrame.new(door.Size.X / 2, 0, 0) local invHingeOffset = hingeOffset:Inverse() local baseCFrame = door.CFrame * hingeOffset local function SetHingeAngle(angle) door.CFrame = baseCFrame * CFrame.Angles(0, angle, 0) * invHingeOffset end -- e.g. local a = 0 while wait() do a += 0.05 SetHingeAngle(a) end
I think CFrame:ToWorldSpace() and ToObjectSpace() would do that, you get the corner’s CFrame relative to the center CFrame, rotate that CFrame around 0,0,0 and then use ToWorldSpace to convert that corner back to global world space, and then use some math to make the center look where it was looking relative to the corner