Hey! While attempting to create the lift mechanic of my hover-car, I stumbled upon an annoying jitter effect which would be present no matter how I tweaked my damping coefficient. The type of force used is a vector force.
Here is a video of it:
https://gyazo.com/f56dfbd699d7e96bf07af9008c47086d
Code used:
function Movement:_handleLift()
for _, v in ipairs(self._liftForces) do
-- Find out the height of the vehicle:
local liftPoint = v.Parent
local liftPointPosition = liftPoint.Position
local raycastResult = workspace:Raycast(liftPointPosition, self._raycastDirection)
if not raycastResult then
-- This lift point is above the lift height and therefore no force is nessecary.
v.Force = Vector3.new(0,0,0)
continue -- Skip to the next point
end
local heightOffGround = (liftPointPosition - raycastResult.Position).Y
-- Apply the force:
local dampingForce = -1000 * v.Parent.Velocity
local direction = liftPoint.CFrame.UpVector
local force = Vector3.new(0, workspace.Gravity * self._mass + self._liftForce, 0) * direction + dampingForce
v.Force = force
end
end
Any solutions are appreciated.