Perfecting a Lock On System (Face Direction vs Look Direction for Attack Animation)


Hello, for a while now I've been working on my lock-on system using Opsive's Aim Assist script as a model. For Tab-Target functionality, I had to derive a new View type from Third Person View Type (to bypass Aim Assist and use my own version).

Anyway, my issue can be viewed in the pictures. My character is 'looking' at the target, so ranged weapons will definitely hit it. However, it's not really facing the object. My melee attacks all venture off toward the View Type's offset.

Is there an easy option to correct the rotation somewhere in locomotion or view type options?

#1 Attack to the left (a simple stab animation that goes relatively forward)
#2 Same attack from above
#3 Attack with guideline after walking forward on line to ensure proper face direction
* so the attack is a tiny bit to the left since the swing comes from the right hand, but not so much as the deviation in #1 and #2

Also: I've turned off Root Motion, Turned on and Off "Rotate Towards Look Source", and Allowed rotation. The player attacks 'forward' because the camera's forward is not the same as the players.

If there's no easy option, I suppose it's time to mess with the locomotion script and possibly derive a new location?



Staff member
With the aim assist what is preventing you from using the built in version? Just curious what I can do since you should be able to use aim assist with a third person view.

To get started is IK affecting your character's limbs? If you get a different motion with the IK component disabled then it is. The CharacterIK component gets the direction that it should look from the ViewType.LookDirection method(Vector3, bool, int, bool) method. You could override this method to return a different direction that the limb should rotate towards.