You can write your topic however you want, but you need to answer these questions:
-
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) -
The problem
I don’t know the math behind it -
What solutions have you tried so far?
Desktop 2023.11.16 - 17.34.14.04 - Trim
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