Skip to main content

Blog Archive

Removing “Tool Lag” from ROBLOX’s First-Person Camera

March 29, 2013

by Kevin He


Archive

ROBLOX Battle Slingshot ScreenshotWe’re constantly striving to perfect the feel of building and playing in ROBLOX. To that end, we recently addressed “tool lag” — a delay seen from the first-person perspective between the view of the camera and the tool or weapon in the player’s hand. While this may seem like a minor enhancement, it goes a long way in improving the quality of the first-person ROBLOX experience. This article serves as not just an introduction to the improvement, but a documented timeline of testing and eventually implementing it.

The Problem:

As recorded in the video below, swinging a weapon or tool in first-person mode at a rapid speed feels laggy. This impacts both the first-person gameplay experience and first-person building experience.

Root Cause:

A torsion (aka rotational) spring is used to connect a humanoid’s torso to the camera’s point of view in first-person mode. This makes first-person camera rotation smooth, but adds a bit of spring lag, which slows rapid movement. In addition, the camera’s orientation and the humanoid’s torso orientation are updated asynchronously — the rendering jobs and the physics jobs are updating the camera and the humanoid in different frequencies, causing stuttering when the tool or weapon is rotated.

The Fix:

The fix is simple: we updated the torso rotation to synchronize with the speed of the camera rotation in first-person mode. Now, the tool turning speed is 100% synchronized with the camera’s panning speed in first person, making for zero lag between the aiming cursor in first-person mode and where the weapon or tool points. This makes first-person controls more intuitive.

Before implementing this fix, we had to test to make sure it didn’t affect the rotational movement of a ROBLOX character when seen from other players’ perspectives. We ran a series of tests that simulated the rotational movement of humanoids in four scenarios:

  • third-person in first-person
  • first-person in first-person
  • third-person in third-person
  • first-person in third-person

We found that the angular error controlled by the torsion spring isn’t being utilized by the remote simulator to actually “drive” the humanoid. The direction a humanoid faces is determined by the standard CFrame sync of the torso itself. In each of the tests, rotation of the remotely simulated humanoid rendered smoothly and without regression.

Side Benefits:

This fix allows us to do away with the torsion spring all together — it doesn’t need to be simulated for the player in first-person mode or other players observing him or her. That means we eliminate the replication of the angular error on the torsion spring over the network, which can cause network spam if enough players are panning their mouse quickly in first-person mode.

Results:

There is a noticeable improvement. Whether it’s a weapon or a tool, having the object in your hand correspond directly to your cursor or crosshair will make for more responsive gameplay. You can experience this update right now. Hop into any game you enjoy playing from the first-person perspective, and see how much more precise and effective you can be.