ADS jitter when moving

  1. What do you want to achieve? Keep it simple and clear!
    Aim down sight

  2. What is the issue? Include screenshots / videos if possible!
    Jitter when moving

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Different methods of manipulation, changing it to be under camera, be moved to cameras cframe with and without tween.

musket:SetPrimaryPartCFrame(camera.CFrame)

the current set of code that moves it to the camera every renderstepped

From the video, it looks like your gun script is rotating joints on your character to position the gun, so when you’re setting the musket’s CFrame again, they’re likely fighting

Have you tried changing the priority of your connection? You could try moving the musket right after camera callbacks have run.
RunService:BindToRenderStep, Enum.RenderPriority

2 Likes

You are first of all, using a deprecated function, use :PivotTo instead.

Second, you can lerp the CFrsme rather than setting it like so:

musket:PivotTo(musket:GetPivot():Lerp(Camera.CFrame,deltaTime*10))

Yup! He needs to Pivot the model after the camera updates, so he should use RunService:BindToRenderStep, with the priority of Enum.RenderPriority.Camera.Value + 1.

thanks i’ll try this later today

the same problem occurs with less jittering, and the musket is still offset when moving

run_s:BindToRenderStep("ADS_Update",Enum.RenderPriority.Camera.Value+1,function(dt)
			musket:PivotTo(camera.CFrame)
-- I tried with and without the Lerp, just to test if it affected the musket offset when moving and it did, i just couldn't eliminate it.
		end) 

That’s because you’re setting the priority wrong. Try subtracting by 1 or just set it to zero.

i tried both, problem still presents, however wouldn’t you want it to update the position after the camera updates so it doesn’t move after the fact

You would need to move the model before the scene is rendered. It would give a more updated result.

Try this:

run_s:BindToRenderStep("ADS_Update",Enum.RenderPriority.Camera.Value-1,function(dt)
	musket:PivotTo(musket:GetPivot():Lerp(camera.CFrame,dt*10))
end)

This time, with the lerp.

This solves the jittering but the musket is still opposite the player movement, i found an alternative solution which was to just find where the camera will be relative to the torso, set the musket to that, and then rotate it from there

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.