TPS Strafing System
Last updated
Last updated
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.
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.
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 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:
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.)
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:
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:
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.
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