My FPS weapon view is really jittery now

If you go to that place, select a spawn point, and equip the weapon, you will see that the FPS view is really jittery while rotating the camera. Zoom all the way into first person to enable the FPS weapon view and pan the camera around.

It wasn’t always like this. It only started doing this since the most recent ROBLOX update yesterday. Before the update, it was perfectly smooth; the arms were fixated with the camera perfectly and never went off-center. To make sure this was not just my code, I went to loleris’s Mad Paintball. The same effect appears to be happening there as well.

In the update, was there a change in how the character rotated in respect to the camera, some change to the RunService::RenderStepped event, or a throttle to the maximum framerate in a local script? If so, is there a good way to remedy the issue? Or will this update be rolled back?

The code is as follows:

game:GetService("RunService").RenderStepped:connect(function() Weld.C0 = (Head.CFrame - Head.CFrame.p):toObjectSpace(Camera.CoordinateFrame - Camera.CoordinateFrame.p):inverse() end)

Thanks in advance

You could try hooking it to RunService::BindToRenderStep.

Example code:

game:GetService("RunService"):BindToRenderStep("WeldUpdate",Enum.RenderPriority.Character.Value,function() Weld.C0 = (Head.CFrame - Head.CFrame.p):toObjectSpace(Camera.CoordinateFrame - Camera.CoordinateFrame.p):inverse() end)

Guess the jitter is due to the new Lua camera controls, but hopefully the above code should fix it.

[quote] You could try hooking it to RunService::BindToRenderStep.

Example code:

game:GetService("RunService"):BindToRenderStep("WeldUpdate",Enum.RenderPriority.Character.Value,function() Weld.C0 = (Head.CFrame - Head.CFrame.p):toObjectSpace(Camera.CoordinateFrame - Camera.CoordinateFrame.p):inverse() end)

Guess the jitter is due to the new Lua camera controls, but hopefully the above code should fix it. [/quote]
It’s definitely better. I used the 0 enumerator (First) instead, and it is much better than it was before, but it still acts extremely jittery. Prior to this update, it was perfectly smooth.

Did you try using a higher value? Using Enum.RenderPriority.Character.Value (300) works for me. The weld must be updated after the camera.

I tried every single one. I decided that, even though it’s far from perfect, it’s definitely the best.

Can this issue be addressed? This update just threw a curve ball at me and many developers on ROBLOX.

I’m having this issue as well, never changed anything.

ROBLOX changed the way that the character moves with the camera. What you want to do is completely remove dependency on using the head position. To calculate the pitch of the gun, take the arc sine of the y component of the camera’s look vector. Remember that the principle values for arc sine are [-pi/2, pi/2], so this will return the correct pitch since ROBLOX constricts the camera to these rotations.

For example:

CFrame.Angles(math.asin(Camera.CoordinateFrame - Camera.CoordinateFrame.p).lookVector), 0, 0)

will return a CFrame matrix with the correct pitch. Don’t forget to localize the math.asin variable for maximum efficiency.

This changed when they added the new RotationType enum.

[quote]Added Enum RotationType
Added EnumItem RotationType.MovementRelative
Added EnumItem RotationType.CameraRelative[/quote]

EDIT: Updated to CFrame.Angles

[quote] ROBLOX changed the way that the character moves with the camera. What you want to do is completely remove dependency on using the head position. To calculate the pitch of the gun, take the arc sine of the y component of the camera’s look vector. Remember that the principle values for arc sine are [-pi/2, pi/2], so this will return the correct pitch since ROBLOX constricts the camera to these rotations.

For example:

CFrame.new(math.asin(Camera.CoordinateFrame - Camera.CoordinateFrame.p).lookVector), 0, 0)

will return a CFrame matrix with the correct pitch. Don’t forget to localize the math.asin variable for maximum efficiency.

This changed when they added the new RotationType enum.

[quote]Added Enum RotationType
Added EnumItem RotationType.MovementRelative
Added EnumItem RotationType.CameraRelative [/quote][/quote]

I think that it was .Angles and also look vector is unit no matter where the CFrame is, so why subtract it’s translation?

[quote] ROBLOX changed the way that the character moves with the camera. What you want to do is completely remove dependency on using the head position. To calculate the pitch of the gun, take the arc sine of the y component of the camera’s look vector. Remember that the principle values for arc sine are [-pi/2, pi/2], so this will return the correct pitch since ROBLOX constricts the camera to these rotations.

For example:

CFrame.new(math.asin(Camera.CoordinateFrame - Camera.CoordinateFrame.p).lookVector), 0, 0)

will return a CFrame matrix with the correct pitch. Don’t forget to localize the math.asin variable for maximum efficiency.

This changed when they added the new RotationType enum.

[quote]Added Enum RotationType
Added EnumItem RotationType.MovementRelative
Added EnumItem RotationType.CameraRelative [/quote][/quote]

I think that it was .Angles and also look vector is unit no matter where the CFrame is, so why subtract it’s translation?[/quote]

You are absolutely right! It should be an angle, and you don’t need to subtract the translation. Not sure what I was thinking :slight_smile:

1 Like

I think I ran into a similar issue to this?
The ultimate solution is to use BindToRenderStep, or to move all RenderStepped connections into a single function for the weapon so theres no desync between them.