Math for realistic real life door?

You can write your topic however you want, but you need to answer these questions:

  1. What I want to achieve:
    Dynamic door (such a door that you can grab onto with a keybind move forward and it would move with you basically like in real life)

  2. The problem
    I don’t know the math behind it

  3. What solutions have you tried so far?
    Desktop 2023.11.16 - 17.34.14.04 - Trim

External Media
local Door = script.Parent
local Interactor = workspace.Interactor


while true do task.wait()
	local Direction = (Interactor.Position - Door.Position).Unit
	local angle = math.atan2(Direction.Z, -Direction.X)
	local Pivot = Door:GetPivot()
	Door:PivotTo(CFrame.new(Pivot.Position) * CFrame.Angles(0, math.clamp(angle, -1.5, 1.5), 0) )
end

I have achieved somewhat close to what I wanted but it has some issues obviously, the player would be infront of the door but as you can see the interactor part when its not to the side its starts jittery glitching back and forth

Gosh, what about using CFrame.LookAt() and detecting if you should reposition?
Maybe, you’re able to limit the LookAt.

I never used math.atan2() before (if you’re seeing it on the future then maybe I would have used it before?)

Not an option that would require much more work and would be harder to figure out