Hello,
I am trying to build a simple ennemy NPC, similar to the one in the Arena Shooter sample.
The NPC should find a cover to reload if no ammo is left, if the NPC has lost line of sight to the target then find a new position, fire to the target, and do some strafe. For now I dont want to make the NPC move while firing so I dont need parralel state trees running.
In the Arena shooter sample, there is a State Tree Condition “HasLineOfSightToTarget”. This function use all kind of vector operation to check if the NPC has a line of sight to the target. I dont understand the point of this heavy code.
Doesnt the perception system already do that ? Also why not just use a line trace from a socket ( like the eyes ), to the target, and see if it colide. If yes, there is no line of sight.
Also bonus question. The state tree in the project seem to always go back to the root at the end of every state. Is it really how you should work with state trees ? I tought that it was best used if we use transition like a state machine, also by using OnEvent transitions.
Thank you!