Skip to content

1. Initial Setup

J1blCblu edited this page Dec 22, 2022 · 25 revisions

This page is up to date to the latest version.
Previous versions may differ, but the core concept is still the same.
Modules are just used to encapsulate the logic.

Initial Character setup

  1. Add LockOnTargetComponent to your character.

image

  1. Set TargetHandlerImplementation to DefaultTargetHandler.

image

  1. Input setup. Input Overview.
  • Target capturing and releasing:

image

  • Target switching with an axis input:

image

Note that the raw input is processed in the component, you don't need to setup any EnhancedInput features.
Perhaps in future updates the input will be processed via EnhancedInput.

Camera Setup

  1. Make sure to set UsePawnControlRotation to true in either SpringArmComponent or CameraComponent.

image

It's recommended to use EnableCameraLag in SpringArmComponent.

image

  1. Add ControlRotationModule to DefaultModules.

image

  1. Expand ControlRotationModule and set RotationMode to LazyInterpolationMode.

image

  1. (Optional) If you want to move the Target from the center of the screen.
  • Change the pitch value in OffsetRotation to -10.f.

image

  • Change ViewRotationOffset in DefaultTargetHandler->DefaultSolver to the opposite value.

image

Target Widget

  1. Add WidgetModule to DefaultModules.

image

Initial Target setup

  1. Add TargetingHelperComponent to the desired AActor.

image

  1. Select the desired mesh in MeshName. Socket location will be calculated within that mesh. If None, then the root component will be used.

image

  1. Select the desired sockets in Sockets. They are used to divide the Target into logical parts that can captured.

image

Note: FocusLocation should be used in camera systems.

Strafe Movement

There are many ways to achieve this behavior. The easiest one will be demonstrated below. For a multiplayer game you may want to extend UCharacterMovementComponent, all necessary information is provided by LockOnTargetComponent. This is not done in the plugin, cause otherwise the plugin would be very complicated and impose restrictions (inheritence from a custom Character).

  1. Add OnTargetLocked/Unlocked events from LockOnTargetComponent:

image

  1. Disable bOrientRotationToMovement in CharacterMovementComponent if used.

image

  1. Add OwnerRotationModule to DefaultModules and set RotationMode to InterpolationMode. Set RotationAxes to Yaw.

image

Packaging Game

Be sure to read this before packaging your project.

Clone this wiki locally