Hello! I'm making an interaction system that includes doors, as shown below.
The problem is that I don't know how to calculate which side the player is on to ensure I open the door in the opposite direction so that the door doesn't always hit the player opening the door.
I was told I could use :Dot(), but until now I've never heard of it and when I looked it up it seemed very confusing.
I have however managed to do a VERY hacky approach to temporarily solve my problem, but I'd like to improve it and ensure that it's a stable approach rather than what I have now.
Video of current code: https://streamable.com/xhilre
Current code that calculates which side the player is on:
local relativeCFrame = character:WaitForChild("HumanoidRootPart").CFrame * StaticDoorPart.CFrame.lookVector
if relativeCFrame.Z > -47 then
tweenModel(door, door.Parent:WaitForChild("BackOpenPosition").CFrame)
else
tweenModel(door, door.Parent:WaitForChild("FrontOpenPosition").CFrame)
end
All help is very much appreciated
