Ninja Bear Studio Plugins Help

Creating Opportunity Attacks

This guide shows how to create an Opportunity Attack using a Gameplay Ability, paired Animation Montages, a Contextual Animation Scene, and an optional Camera Animation.

For an overview of the feature, see Paired Animations.

Required Components

Each character participating in the paired animation must have these components:

  1. A Contextual Animation Scene Actor Component.

  2. A Motion Warping Component, which may already be present if the character uses Melee Attacks.

Add the Required Components

  1. Open your base character class or blueprint.

  2. Click the Add button in the Component List and add NinjaCombatMotionWarpingComponent.

  3. Click the Add button in the Component List and add ContextualAnimSceneActor.

  4. Implement GetMotionWarpingComponent from CombatSystemInterface, returning your Motion Warping Component.

Contextual Animation

Contextual animations are configured through a scene asset that plays Animation Montages for each defined role.

To create the scene, define the roles, prepare the montages, and then create the Contextual Animation Scene.

Define Contextual Roles

Contextual Roles Asset
  1. Create a new Data Asset based on ContextualAnimRolesAsset.

  2. Add a new role named Victim.

    Configure the role:

    • Mark it as a Character.

    • Set the capsule Half Height and Radius to match the character's Capsule Component.

    • Set Mesh Rotation Yaw to -90, matching the common mesh rotation used by Character Blueprints.

  3. Add a new role named Attacker and configure it with the same values used by the Victim role.

Create the Attacker Montage

Attacker Animation Montage
  1. Create an Animation Montage for the attacker.

  2. Set the montage to use the correct full-body Slot.

  3. Make sure the source Animation Sequence has Root Motion enabled.

  4. Add Melee Scan Animation Notify States as needed.

    • You can use different Gameplay Effects for each hit.

    • For example, early hits can apply partial damage, while the final hit can apply fatal damage.

  5. Add a Motion Warping Animation Notify State and name it ExecutionWarp.

Create the Victim Montage

Victim Animation Montage
  1. Create an Animation Montage for the victim.

  2. Set the montage to use the correct full-body Slot.

  3. Make sure the source Animation Sequence has Root Motion enabled, if the victim animation moves the character.

  4. If this animation represents fatal damage, add the Death Animation Notify.

  5. Optionally, add the Ragdoll Animation Notify.

Create the Contextual Scene

Contextual Scene Asset
  1. In the Content Browser, click the Add button and select AnimationContextual Anim Scene.

  2. Open the new asset and set the Roles Asset created earlier.

  3. Click Update Roles and confirm.

  4. For the Primary Role, select Victim.

  5. Click New Animset and configure it:

    • Set the Section Name to identify the scene.

    • Set the Animation Montage for the Victim role.

    • Set the Animation Montage for the Attacker role.

  6. In the Timeline, select the Attacker role track.

  7. In the Mesh To Scene panel, adjust the attacker position to match the intended animation distance.

  8. Select the Victim role track and adjust rotation as needed.

  9. Add a new Warp Point Definition:

    • Set Warp Target Name to ExecutionWarp. This must match the name used by the Motion Warping Animation Notify State.

    • Set Mode to Primary Actor, so the warp targets the victim.

    • Click Update Warp Points.

Camera

Opportunity Attacks can play Camera Animations along with the Contextual Animation Scene.

Camera Animations are played through the Player Camera Manager, so your Player Controller must use a compatible camera manager.

Use the Combat Camera Manager

  1. Create a Player Camera Manager based on NinjaCombatPlayerCameraManager.

  2. Assign this Player Camera Manager to your Player Controller.

  3. If you cannot use NinjaCombatPlayerCameraManager, implement CombatCameraManagerInterface in your own Player Camera Manager.

    In that case, implement PlayCombatCameraAnimation and StopCombatCameraAnimation.

Create Camera Animations

  1. In the Content Browser, click the Add button and select CinematicsCamera Animation.

  2. In the Content Browser, click the Add button and select CinematicsLevel Sequence.

  3. Create and open an empty level to author the Camera Animation.

  4. In the empty level, place your Player Character Blueprint or a simpler reference blueprint.

    The blueprint should have the correct camera setup and a Mesh or Animation Blueprint able to play the Attacker Animation Montage.

    Place this blueprint at location [0, 0, 0] and rotation [0, 0, 0].

  5. Add a Cine Camera Actor to the level and position it to match the camera location from the Player Blueprint.

    Optionally, set Lens Settings to 12mm Prime and Crop Settings to 2.39.

  6. Add a Camera Cuts Track to the Level Sequence.

  7. Add the Player Blueprint from the level to the sequence.

  8. Add the Cine Camera from the level to the sequence.

  9. If Sequencer starts piloting the camera, click Eject to return to regular viewport navigation.

  10. Remove the Transform track from the Cine Camera, since the camera movement will be authored in the Camera Animation asset.

  11. Save this level as a reusable Camera Animation Authoring Level.

  12. Add an Animation track to the Player Blueprint and select the Attacker Animation Sequence.

  13. Adjust the timeline length to match the animation.

  14. Add a Template Sequence to the Cine Camera track and select the Camera Animation.

  15. Animate the camera by creating keyframes for changes in location, rotation, and other camera properties.

    For smoother transitions, it is usually best for the camera to return to its origin point by the end of the animation.

  16. Optionally, create Camera Shake assets and add them to the timeline on each attack.

Create a Camera Anchor

  1. Create a new Actor Blueprint based on NinjaCombatCameraAnchorActor.

  2. Optionally, modify the Camera Component to use a different camera type.

Gameplay Ability

Opportunity Attacks are executed by CombatAbility_OpportunityAttack, using the assets configured in the previous steps.

Configure the Opportunity Attack

Opportunity Attack Ability
  1. Create a new Gameplay Ability based on CombatAbility_OpportunityAttack.

  2. Set a Targeting Preset to select eligible targets.

  3. Set the Contextual Animation configured for the attack.

  4. Set the Camera Animation, if the attack uses one.

  5. Set the Camera Anchor Class, if needed.

  6. Add an Activation Tag for the Opportunity Attack.

  7. Grant the Gameplay Ability to the owner.

  8. Configure input or interaction logic to activate the ability.

29 June 2026