Devil May Cry style Lock-on Movement?



I’m wondering if anyone can assist me with a problem I am having.

Basically I have my player pivot around an object with a Static Camera.

I need to adjust my controls depending upon the position of my player in relation to the Object.

If this isn’t clear enough I will try to explain further.

Many Thanks

I should point out the Character is fixed, I just want a rotation for the Player much like a lock-on in Devil May Cry or a Boxing Game.


If the structure is a clean as you make it here, you can figure out the angle of player with respect to pivot/object using Mathf.Atan2(). Something like (untested);

Vector3 v3Pos = player.transform.position - pivot.transform.position.
float angle = Mathf.Atan2(v3Pos.y, v3Pos.x);
if (angle < 0.0f) angle += 360.0f;

With the angle, you can code your behaviors however you want based on the quadrants you specified above.