I spent today making a physics-based interaction system based on Amnesia: The Dark Descent's interaction system and also one tyridge77 once made (although it seems the testing place he had up for it is long gone). For example, to interact with a lever you would click on the lever and move your mouse up to drag it up, and to interact with a valve you would click on it and spin your mouse in circles.
Here's a video of it in action once I was done with it for the most part
However, it still feels a bit 'ugly'. The objects being interacted with don't move very smoothly (in the video you can see I can't even rotate the valve in third person). To make these parts follow the mouse I'm using a bodyPosition and this code:
renderService.RenderStepped:connect(function()
local t=tick()
local dt=t-last
last=t
SetValue:FireServer(workspace.deltaTime,dt)
--setting a number value in workspace so other scripts can get the deltaTime easily.
if(bP and isGrabbing) then
mouse.TargetFilter=bP.Parent
local dist=(bP.Parent.Position-hRP.Position).magnitude
local lv = CFrame.new(hRP.Position,mouse.Hit.p)
bP.position=(hRP.Position+lv.lookVector*dist)
end
end)
The mouse movement part was mostly ripped from a gravity gun tool I found on freemodels since I'm bad with mouse-based stuff.
How can I improve it to make it work smoother?
