So I made this VR Door for my VR Swat game, but it feels snappy when you grab onto the handle
I was hoping somebody could help. I don’t want to use tweens unless I absolutely have to.
Here is my code:
if Door_Right ~= nil then -- Checks if we're holding a door handle
local doorModel = Door_Right.Parent -- Gets the whole door
local hinge = doorModel:FindFirstChild("hinge") -- Gets the hinge
local hand = camera.CFrame*move -- Just the hand CFrame
local x,y,z = CFrame.lookAt(hinge.Position,hand.Position):ToOrientation() -- Uses a CFrame for the orientation
local angle = math.deg(y) -- Current angle in degrees
if angle < 75 and angle > -75 then -- Door Limits
hinge.CFrame = CFrame.new(hinge.Position.X,hinge.Position.Y,hinge.Position.Z)*CFrame.Angles(0,y,0) -- Set the y orientation of the door with the same position.
end
ssevents:FindFirstChild("SetHandleCFrame"):FireServer(hinge,hinge.CFrame) -- Multiplayer replication
end