Charge Node RotateTowards condition

nathanj

Active member
hi Justin,

Could you explain how
Code:
 if (tacticalAgent.RotateTowardsPosition(TransformPoint(attackCenter, offset, attackRotation)))
would be set to true?

I'm completely stuck on this and can not figure it out. The demo scene works fine but I'm using RPG Builder AI agents and they are rotation towards the agent after being positioned into their charge formation but they never attach from this point. They just stay in alignment and keep rotating towards the player as the player moves around them.

And where is the "canAttack" boolean being set for this? I can't find the event that sets it.

Thank you,
Nathan
 
Last edited:
Take a look at NavMeshAgent.RotateTowards. RotateTowardsPosition will return true when the agent is looking at the target.

And where is the "canAttack" boolean being set for this? I can't find the event that sets it.
It is set at the start of the task, and when the leader is updated. This variable is only used by the leader.
 
For some reason my leader and agents appear to be looking at the player but it always returns false.
Sorry to be a pain, where would I find the event that changes the canAttack bool for the leader?
 
TacticalAgent.OnStart sets canAttack to false. I would debug this by outputting the rotation within the NavMeshAgent.RotateTowards method.
 
Top