Force Aim Assist on target

alonsogm4

New member
Hi there! I'm making a game mechanic where I have two agents, one seeks (AI) and the other flees (player, in first person). I have set a trigger to know when the player is too close to my AI agent to force the player to look at the agent. I'm working with aim assist, and it works great, but the player aims at the agent only after looking at it. If the player continues to run away from the agent, without looking back at the agent, it doesn't work.

Is there a way to force the player to look at the agent even when looking away? Any help is appreciated!
 
There was a thread a while back about forcing the camera to look at a specific object, but unfortunately I can't find it. However in this thread I describe the basics of manually setting the character's rotation:


You'd just need to calculate the desired rotation of the character, which would be something like Quaternion.Euler(targetObject.transform.position - transform.position)
 
Thanks Andrew, that seems to work! I just need to work out the correct rotation as Quaternion.Euler doesn't seem to return the correct rotation (rotates like 90 degrees instead of 180).
Thanks!
 
Top