TPS Strafing System

Overview

The TPS Strafing System is a movement method commonly used in third-person shooter (TPS) games. In this system, the character moves relative to the camera’s direction. The torso stays aligned with the aiming point, while the lower body moves according to the player’s movement direction. This allows the upper and lower body animations to play independently, enabling more flexible aiming and movement control.

How to Use

Activate Use Strafing Animations

After selecting the players in the Level Browser, activate Use Strafing Animations.

When this option is deactivated, the single movement animation will play.

When this option is enabled, animations will play in eight directions (up, down, left, right, and diagonally) based on the character’s movement direction. This allows the character to move naturally in various directions, such as strafing, reversing, and diagonal movement.

Deactivate Use Strafing Animations
Activate Use Strafing Animations

When only the Use Strafing Animations option is enabled, the difference may not be visually noticeable. This feature must be used in conjunction with the following settings to fully experience its effects.

Set the character’s rotation direction based on the camera’s direction

Set the RotationType of UserGameSettings to CameraRelative so that the character rotates according to the direction of the camera.

(To restore existing settings, set it to Enum.RotationType.MovementRelative.)

In StarterCharacterScripts, write the following code for LocalScript:

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

repeat wait() until LocalPlayer.Character
local Character = LocalPlayer.Character
local Humanoid = Character:WaitForChild("Humanoid")

local UserGameSettings = UserSettings().GameSettings
UserGameSettings.RotationType = Enum.RotationType.CameraRelative

When the character’s rotation is set to follow the camera (CameraRelative) and the Use Strafing Animations option is enabled, the character will always face the direction of the camera. This setup allows the torso animation to align with the camera (aiming direction), while the lower body animations play independently based on the movement direction.

If RotationType is set to CameraRelative, the character’s rotation speed based on the camera direction can be controlled using the CharacterTurnRateWhenUsingCameraRelative value. (The default value is -1, which means the character will rotate instantly.)

UserGameSettings.CharacterTurnRate = 200

Apply Camera Offset

The camera’s relative position can be adjusted using the CameraOffset attribute. In TPS games, the character is typically positioned slightly off-center to prevent the character from overlapping with the aiming point on the screen.

In StarterCharacterScripts, write the following code for LocalScript:

local Workspace = game:GetService("Workspace")
local Camera = Workspace:WaitForChild("Camera")

Camera.CameraOffset = Vector3.new(90, 90, -120)

Changing the Torso Animation

The character’s torso and lower body animations can be played separately, regardless of the Use Strafing Animations option. If the UpperBodyAnimation attribute is set to “True” in the animation track, the animation will apply only to the torso.

In StarterCharacterScripts, write the following code for LocalScript:

local Animation = Instance.new("Animation")
Animation.AnimationId = "BasicHandgunIdleAnimation"

local Animator = Humanoid:FindFirstChild("Animator")
local AnimationTrack = Animator:LoadAnimation(Animation)
AnimationTrack.UpperBodyAnimation = true
AnimationTrack.Priority = Enum.AnimationPriority.Movement 

AnimationTrack.Looped = true
AnimationTrack:Play()

When Use Strafing Animations and UpperBodyAnimation are used together, the torso follows the aiming direction while the lower body moves according to the movement direction, resulting in more natural and dynamic character animations.

Usage Examples

  • RotationType settings according to whether a gun is equipped

    • When no gun is equipped, it is set to MovementRelative, and the default movement animations are played

    • When a gun is equipped, it switches to CameraRelative to lock the character’s vision

  • RotationType settings according to whether or not the character is aiming when a projectile weapon is equipped

    • When the character is not aiming, it is set to MovementRelative, and the default movement animations are played

    • When the character is aiming, it switches to CameraRelative to lock the character’s vision

  • CameraOffset is processed differently depending on the weapon type

Strafing Animation Assets

Use the animation package by searching for the asset name in the Asset Drawer. (You can also use the asset directly in the script without placing it in the Level Browser by using the Asset Id.)

Learn How to Play Animations

Character Animation

Animation
Animation Id

ovdrassetid://18426300

  • Asset Name : BasicWalkAnimations

    • BasicWalkForwardAnimation

ovdrassetid://18429100

  • Asset Name : BasicWalkAnimations

    • BasicWalkLeftAnimation

ovdrassetid://18427600

  • Asset Name : BasicWalkAnimations

    • BasicWalkForwardLeftAnimation

ovdrassetid://18428100

  • Asset Name : BasicWalkAnimations

    • BasicWalkForwardRightAnimation

ovdrassetid://18430100

  • Asset Name : BasicWalkAnimations

    • BasicWalkRightAnimation

ovdrassetid://18427200

  • Asset Name : BasicWalkAnimations

    • BasicWalkBackLeftAnimation

ovdrassetid://18427400

  • Asset Name : BasicWalkAnimations

    • BasicWalkBackRightAnimation

BasicWalkBackAnimation

or

ovdrassetid://18426100

  • Asset Name : BasicWalkAnimations

    • BasicWalkBackAnimation

ovdrassetid://18400100

  • Asset Name : BasicAnimations

    • BasicRunForwardAnimation

ovdrassetid://18402100

  • Asset Name : BasicAnimations

    • BasicRunLeftAnimation

ovdrassetid://18401200

  • Asset Name : BasicAnimations

    • BasicRunForwardLeftAnimation

ovdrassetid://18403200

  • Asset Name : BasicAnimations

    • BasicRunForwardRightAnimation

ovdrassetid://18406100

  • Asset Name : BasicAnimations

    • BasicRunRightAnimation

ovdrassetid://18408100

  • Asset Name : BasicAnimations

    • BasicRunBackLeftAnimation

ovdrassetid://18409100

  • Asset Name : BasicAnimations

    • BasicRunBackRightAnimation

ovdrassetid://18406200

  • Asset Name : BasicAnimations

    • BasicRunBackAnimation

Last updated