I’m improving my jump pad code and I am trying to calculate the force required to move the player X amount. Here’s the relevant code:
-- Compute the jump vector from the target position.
if jumpVector == nil then
local pos = ident:GetPivot().Position
jumpDist = (targetPos - pos).Magnitude
local cframe = CFrame.new(pos, targetPos) * CFrame.Angles(math.rad(30), 0, 0)
local dir = cframe.LookVector
jumpVector = Vector3.new(
dir.X * jumpDist * 25,
dir.Y * jumpDist * 10,
dir.Z * jumpDist * 25
)
end
The issue is that depending on where the target position is, I end up with too little or too much force. The coefficients were determined empirically, but that’s only for one scenario. When I changed the scenario (the target position), I way overshot the target. I figure this is going to be a sliding scale of some sort, but at this point I am at a loss.