So in my game I have a check to see if the player is above, or looking in the direction of a boost pad (a wedge part), if they are, they are then sent flying in the direction the pad is facing. This works fine as long as the player has a high framerate, however I've been consistnantly seeing players with framerates of >30/20 who are overshooting the arc considerably. The way the Boost reduction works is tied to framerate, so this will give some players a huge advantage/disadvantage.
I have the following code:
local BoostStart
local BoostEnd
local Speed
local Boosted = false
local function Boost(Pad)
if Pad.Name == "Boost" and Boosted == false then
Boosted = true
BoostStart = Pad.CFrame*CFrame.new(0,-Pad.Size.Y/2,-Pad.Size.Z/2)
BoostEnd = Pad.CFrame*CFrame.new(0,Pad.Size.Y/2,Pad.Size.Z/2)
Speed = 100
if Pad:findFirstChild("Speed") then
Speed = Pad.Speed.Value
end
end
end
which is called by:
local ray = Ray.new(humanoid.Torso.Position,Vector3.new(0,-5,0))
local hit,pos = game.Workspace:FindPartOnRay(ray,LocalPlayer.Character)
if hit then
Boost(hit)
end
local ray = Ray.new(humanoid.Torso.Position,(humanoid.Torso.CFrame.lookVector)*3)
local ignore = {LocalPlayer.Character; workspace.CurrentCamera}
local hit,pos = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignore)
if hit then
Boost(hit)
end
moveFunc(LocalPlayer, adjustedMoveValue, true)
local Herp = humanoid.Torso.Velocity:lerp(Vector3.new(humanoid.MoveDirection.X*(30),humanoid.Torso.Velocity.Y,humanoid.MoveDirection.Z*(30)),.1)
if Boosted == true then
BoostEnd=BoostEnd*CFrame.new(0,-.1,0)
humanoid.Torso.Velocity = (BoostEnd.p-BoostStart.p).unit*Speed
if BoostEnd.p.Y < BoostStart.p.Y then
Boosted = false
end
else
humanoid.Torso.Velocity = Herp
end
This is within the ControlScript's master script, updating every frame, is there anything I can change here to create a consistant "arc" regardless of framerate, or to make it as close as possible? Many thanks!
