Hi Playcanvas Community,
I recently worked on a project that required an enemy field of view (FOV) system. Initially, I used a cone mesh for detection, but it failed to account for obstacles, leading to enemies being detected even when obstructed. To address this, I developed a dynamic enemy detection system that adjusts in real-time, accurately detecting enemies while considering obstacles. This ensures precise and reliable enemy tracking, even in complex environments.
Checkout this Dynamic Enemy Field of View - PLAYCANVAS and share your valuable feedback.
Thanks!
3 Likes
Hi @Hassan_Amjad1!
That’s great! I was looking for something like this as well. Are you going to share your solution?
It looks like you are currently doing this in the update
function. If so, I suggest to do this in the postUpdate
function, to get a smoother result.
Hey @Albertos
Sorry, my question is not related to the main subject of this topic, but I am curious to know why you say that using “postUpdate” results smoother than “update” function?
The raycasts are based on the position of the player entity. If the player entity is moving and the raycasts determine the position at the same time, you will see a little glitch at the edges.
Oh, got it!
Thanks for the lesson!
1 Like
Thanks @Albertos for your suggestion. I have applied your suggestion and here is the project:
https://playcanvas.com/project/1286850/overview/dynamic-enemy-field-of-view