Bug fixes, stabilized unlocked framerate.
Fixed Roblox's camera butting into my custom camera again. Fixed a regression with the floor dragging system's decay rate. Patched a bunch of code to work better with an unlocked framerate.
This commit is contained in:
parent
910b1f392d
commit
05b67445d1
|
|
@ -2,11 +2,6 @@ local RunService = game:GetService("RunService")
|
|||
local UserInputService = game:GetService("UserInputService")
|
||||
local Players = game:GetService("Players")
|
||||
|
||||
local playerScripts = script.Parent
|
||||
local playerModule = require(playerScripts:WaitForChild("PlayerModule"))
|
||||
|
||||
local cameraSystem = playerModule:GetCameras()
|
||||
|
||||
local main = require(script:WaitForChild("Main"))
|
||||
local popper = require(script:WaitForChild("Popper"))
|
||||
local opacity = require(script:WaitForChild("Opacity"))
|
||||
|
|
@ -45,16 +40,12 @@ main:SetEnabled(true)
|
|||
opacity:SetEnabled(true)
|
||||
|
||||
-- Overload the camera update function.
|
||||
function cameraSystem:Update()
|
||||
if cameraSystem.activeCameraController then
|
||||
cameraSystem.activeCameraController:Enable(false)
|
||||
cameraSystem.activeCameraController = nil
|
||||
end
|
||||
|
||||
local function update()
|
||||
main:Update()
|
||||
popper:Update()
|
||||
opacity:Update()
|
||||
|
||||
RunService:UnbindFromRenderStep("cameraRenderUpdate")
|
||||
end
|
||||
|
||||
playerScripts:RegisterTouchCameraMovementMode(Enum.TouchCameraMovementMode.Default)
|
||||
playerScripts:RegisterComputerCameraMovementMode(Enum.ComputerCameraMovementMode.Default)
|
||||
RunService:BindToRenderStep("RetroCamera", 250, update)
|
||||
|
|
@ -135,4 +135,4 @@ local function update()
|
|||
lensFlareNode.Parent = nil
|
||||
end
|
||||
|
||||
RunService:BindToRenderStep("LensFlareUpdate", 201, update)
|
||||
RunService:BindToRenderStep("LensFlareUpdate", 1000, update)
|
||||
|
|
@ -20,4 +20,4 @@ local function moonUpdate()
|
|||
end
|
||||
end
|
||||
|
||||
RunService:BindToRenderStep("MoonUpdate", 201, moonUpdate)
|
||||
RunService:BindToRenderStep("MoonUpdate", 1000, moonUpdate)
|
||||
|
|
@ -155,6 +155,6 @@ local function updateSky()
|
|||
end
|
||||
end
|
||||
|
||||
RunService:BindToRenderStep("UpdateSky", 201, updateSky)
|
||||
RunService:BindToRenderStep("UpdateSky", 1000, updateSky)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
@ -77,4 +77,4 @@ local function update()
|
|||
adorn.Parent = nil
|
||||
end
|
||||
|
||||
RunService:BindToRenderStep("SunRays", 201, update)
|
||||
RunService:BindToRenderStep("SunRays", 1000, update)
|
||||
|
|
@ -45,16 +45,15 @@ local function update(dt)
|
|||
end
|
||||
|
||||
local yVel = rootPart.Velocity.Y
|
||||
local step = dt * stepRate
|
||||
|
||||
if math.abs(yVel) > 8 then
|
||||
local goal = math.sign(yVel)
|
||||
humanoid.HipHeight = moveTowards(humanoid.HipHeight, goal, step)
|
||||
humanoid.HipHeight = moveTowards(humanoid.HipHeight, goal, stepRate * dt)
|
||||
elseif lastLevel ~= level then
|
||||
humanoid.HipHeight = math.sign(lastLevel - level) * math.clamp(dist - 3, 0, 1)
|
||||
lastLevel = level
|
||||
else
|
||||
local decay = decayRate ^ (step * 60)
|
||||
local decay = decayRate ^ (dt * 60)
|
||||
humanoid.HipHeight = humanoid.HipHeight * decay
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ local function isFinite(num)
|
|||
return num == num and num ~= 1/0 and num ~= -1/0
|
||||
end
|
||||
|
||||
local function rotateCameraTowardsGoal()
|
||||
local function rotateCameraTowardsGoal(dt)
|
||||
local camera = workspace.CurrentCamera
|
||||
|
||||
if camera then
|
||||
|
|
@ -87,7 +87,7 @@ local function rotateCameraTowardsGoal()
|
|||
if isFinite(angleBetween) then
|
||||
local abs = math.abs(angleBetween)
|
||||
local sign = math.sign(angleBetween)
|
||||
local rotation = math.min(0.01, abs)
|
||||
local rotation = math.min(dt * 6, abs)
|
||||
|
||||
local cfLocal = focus:toObjectSpace(cf)
|
||||
camera.CFrame = focus * CFrame.Angles(0, -rotation * sign, 0) * cfLocal
|
||||
|
|
@ -218,7 +218,8 @@ local function canRenderDisk(rendering)
|
|||
return false
|
||||
end
|
||||
|
||||
local function render3dAdorn()
|
||||
local function render3dAdorn(dt)
|
||||
local dt = math.min(0.1, dt)
|
||||
disk.Visible = canRenderDisk(true)
|
||||
|
||||
if disk.Visible then
|
||||
|
|
@ -233,7 +234,7 @@ local function render3dAdorn()
|
|||
if currentGoal then
|
||||
goalDisk.Visible = true
|
||||
goalDisk.CFrame = CFrame.new(currentGoal) * DISK_OFFSET
|
||||
rotateCameraTowardsGoal()
|
||||
rotateCameraTowardsGoal(dt)
|
||||
else
|
||||
goalDisk.Visible = false
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue