Hi there!
I’ve made a movement script attempting to emulate the Quake/Source engine style of movement to some success. My main problem is this stuttering camera that gets worse when I increase speed. I’m not entirely sure how this happened as I haven’t messed with the camera at all. It’s also got 2 other issues that may be related, including some minor lag on the Roblox place which doesn’t occur on Studio and an issue with jumping where the game thinks the player has landed before they actually have, causing the character to almost instantly fall back to the ground unless at a certain height above it.
I don’t want to post the entire code because it’s quite long and I’m not ready to put the whole thing out to the world, but you can get a good idea of what it is by looking at this code which I based mine off of, as well as Roblox’s ControlModule script which I am attempting to put my code into so that it can be used across multiple devices.
This is the function which runs all the other functions which I think may be the cause. As you can see it’s RenderStepping a lot of stuff.
RunService:BindToRenderStep("ControlScriptRenderstep", Enum.RenderPriority.First.Value, function(dt)
self:OnRenderStepped(dt)
end)
function ControlModule:OnRenderStepped(dt)
if self.ActiveController and self.ActiveController.enabled and self.Humanoid then
self.ActiveController:OnRenderStepped(dt)
self.Grounded = self:CheckGround()
self.HeightCap = self:CheckHeight()
if self.Grounded then
self:GroundMove()
self:UpdateSprint()
elseif self.Grounded == false then
self:AirMove()
end
Humanoid.HipHeight = HipHeight.Value
Humanoid.WalkSpeed = self.PlayerVelocity.Magnitude
self.MoveFunction(LocalPlayer, self.WishDir, false)
self.Humanoid.Jump = self.ActiveController:GetIsJumping()
self.Sprint = self.ActiveController:GetIsSprinting()
self.Crouch = self.ActiveController:GetIsCrouching()
self:UpdateCrouch()
end
end
This is probably where the issue comes from but I don’t know what in there makes it break (other than too much RenderStepping) or what to do to fix it. Functions like self:GroundMove() and self:AirMove() also run other functions within them (self:UpdateMovement(), self:ApplyFriction() and self:Accelerate()) that help them to calculate a bunch of stuff to make it do what I want.
(I have tried to upload a video of what I mean but Devforum doesn’t seem to like any of the videos I upload, they weren’t great quality anyway because my PC isn’t the best and it doesn’t handle recording videos very well. Sorry about that)
Any and all help is appreciated
Thanks.