0 of 0

File information

Last updated

Original upload

Created by


Uploaded by


Virus scan

Safe to use

About this mod

Replaces W3's automatic targeting algorithm with a better, much more consistent one. Includes option menu to tweak to your playstyle and control method.

Permissions and credits
Enhanced Targeting
(for Witcher 3 1.12)


Witcher 3's automatic targeting fails to impress, especially in combination with the "softlock" mechanism -- targets can change wildly for seemingly no particular reason, during a dodge, for example, which can lead to violent (and frustrating!) deaths from being locked in an animation in a completely unintended direction. This mod replaces Witcher 3's automatic targeting with one that is much more consistent, particularly for mouse and keyboard controls, though a controller preset is available in the menu. An options menu is also provided with which to tweak exactly how targeting works -- find what works for you and your playstyle!

The new algorithm (with the default values) tries to pick targets that are, in order of importance:

  • close to the player
  • near the angle of camera
  • near to player movement
  • near player's facing

It also tends to "snap" to targets, particularly if the player is attacking them, drastically minimizing target jitter.

1. Copy the entire "modEnhancedTargeting" folder into "[Path To The Witcher 3]\mods" folder
2. (Optional but recommended) Install the menu by navigating to "[Path To The Witcher 3]\mods\modEnhancedTargeting" folder and copying the entire "bin" folder into your "[Path To The Witcher 3]" folder

Be sure to run Script Merger if you have any other mods installed.

Extra Long Description:
But how does vanilla targeting actually work?

Vanilla targeting has a system that ranks targets based on three weighted criteria: distance, angular difference (from a situation dependent vector), and a weighted ring. The relative weights of these criteria are also based on the situation. The weighted ring is a flat value based on if the target is within 6 meters of the player or another value if it is outside of that ring. The ultimate "rank" is basically each criteria, multiplied by their weight, added together. For example, the formula for getting the "rank" when the player is standing still is:

(.75 * angularDistanceFromCamera) + (.25 * distanceFromEnemy) + (0 * weightedRing)

Which seems fine, right? The enemy that is closest to the angle of the camera and is the closest to the player is chosen, which makes sense. What happens when the player starts moving?

(.275 * angularDistanceFromMovementDirection) + (.375 * distanceFromEnemy) + (.35 * weightedRing)

Hmm... now it's completely ignoring camera direction in favor of choosing the closest enemy in the direction of movement. It has a certain sense to it, if you're moving in a direction then enemies in that direction become much more important right? What happens when you are dodging?

(.575 * angularDistanceFromEvadeDirection) + (.175 * distanceFromEnemy) + (.25 * weightedRing)

This should be where you start going huh? How many different weights are there? How many different directions are there? There are lots. Are you swimming? Are you channeling a sign? Did you start moving during a counter? Are you aiming? Are you in combat? Are you using a special attack? Do you currently have a "moveTarget"?

The bad thing isn't that it's complicated and cumbersome (and has more than two thousand of lines of script), it's that most of the things that affect target choice change rapidly, which is why the target can seem to jump around. As soon as you exit an animation, the method of scoring a target changes, which has a chance at changing the target. Evade backwards, it will swap to the target behind you, but as soon as it exits the evade animation, it swaps back to targets in front of you. Start moving left, and it'll swap to an enemy on the left, but as soon as you start an attack, it'll change to another target.

It can't be this bad because it only screws up sometimes for me!

What does the average fight in Witcher 3 look like? Three targets? Four? If I chose a completely random number from 1 to 5 for each target and then weighted that number by how close it was to the player, it'll most often chose the target that is closest, which is, generally, the one that the player is most interested in. That isn't to say that the targeting was random, because it's not, it's just sort of complicated. If you're used to the targeting and have worked out that generally speaking, the closest target in the direction of attack or movement is the one normally chosen, then you can make a video like this.

So how do you fix this in your mod?

I started from scratch and didn't try to fix the vanilla system, which honestly probably could have been done, and maybe CD PROJEKT RED will decide to do that. My guidelines and thought process are below:

Simplicity and Predictability:

There is a single, relatively simple ranking formula with a single set of weights, which never abruptly changes.

Swap Targets Less Frequently

Targets don't change based on tiny, moment to moment differences and tend to 'snap' from one target to the next. This is done by introducing hysteresis; in order to change targets, the new target must be ranked higher then the current target by some percentage. That doesn't mean that the system is sluggish, it isn't! Additionally, if the player is attacking, the hysteresis is increased so that the target doesn't abruptly change in the attack animation.

Pick the Target that the Player is Most Interested In

How do you judge player interest? Well, if you are interested in a target, what do you do? You turn the camera towards them, you attack towards them, and you move towards them. Which targets are you generally most interested in? The ones closest to you. The ranking formula reflects this by using the closeness of a target to you as a multiplier to the angular differences. The camera is weighted much higher than player movement.

If you are interested, as of right now, the formula is as follows (MATH AHEAD!):

closeness = (TARGETING_DIST - distanceToTarget) / (TARGETING_DIST / 2)
angleDiffRatio = (180 - degreesFromAngle) / 180
cameraRank = cameraAngleDiffRatio * cameraWeight
movementRank = headingAngleDiffRatio * movementWeight
facingRank = facingAngleDiffRatio * facingWeight

rank = (cameraRank + movementRank + facingRank) * closeness

If ((hysteresis * curTargetRank) > newTargetRank), then the new target is selected. Hysteresis is increased by 50% when you are attacking.

Just delete modEnhancedTargeting from your "[Path To The Witcher 3]\mods" directory and modEnhancedTargetingConfig.xml from your "[Path To The Witcher 3]/bin/config/r4game/user_config_matrix/pc" folder.

This mod modifies the `r4player.ws` and `playerWitcher.ws` files!

If you have another mod that modifies this file (and this file is often modified), then they will be incompatible. You can solve most comparability problems relating to this by using Script Merger. So if you've installed other mods, please run Script Merger!

My Other Witcher 3 Mods:
Fast Travel from Roach
Better Keybinds