In my game, the player controls a ball. Currently, I have the system working with the code and setup below. However, there is one issue: the ball feels heavy and unresponsive when trying to switch direction.
All the solutions I have found online involve increasing the force and therefore the speed. I don’t want to make the speed any faster though. How can I make the ball feel less heavy without increasing the maximum speed? I think I basically need to detect when the direction of the ball changes and add a higher force until it switches direction.
Ball setup (sphere part containing two VectorForces):
My code for moving the ball:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
RunService.RenderStepped:Connect(function(dt)
local newMoveDirection = Players.LocalPlayer.Character:WaitForChild("Humanoid").MoveDirection
currentBall.MoveForce.Force = newMoveDirection * 1500
-- apply drag force to limit the speed
local speed = currentBall.AssemblyLinearVelocity.Magnitude
if speed > .1 then
currentBall.DragForce.Force = -currentBall.AssemblyLinearVelocity.Unit * (speed^2) * Vector3.new(1, 0, 1)
else
currentBall.DragForce.Force = Vector3.zero
end
end)
Video of the “heavy” feeling problem:
(notice how it takes a while to slow down to change direction)
Use lower density on CustomPhysicalProperties and maybe even turn massless on. Alternatively, try multiplying the force with a fraction of or the entire mass itself so it scales with mass.
Looks like using CustomPhysicalProperties and lowering the density worked great. I have now caused another issue though - I had code that would shoot the ball forward on jump.
With the lower density, this doesn’t work. I have tried increasing the force in the first Vector3, but it doesn’t work. Do I have to tweak any of the other CustomPhysicalProperties or would it just be the density that is affecting this? If it’s the density, how could I keep my “propel” effect with the new density?