Forum begins after the advertisement:
-
::My bat enemy cant reach me if i am under a platform. How do i use raycast to make it avoid obstacles.
::Anuk, having your bat do pathfinding around the platform will involve quite a bit of complexity. We go through some examples of raycasting in the series, and you will have to adapt that code to your bat to have it path around the platform.
Alternatively, you can look into putting the bat in its own layer and adjust the Layer Collision Matrix in Unity, so that it can pass through platforms: https://docs.unity3d.com/Manual/LayerBasedCollision.html
Or you can look into using this 2D NavMesh for Unity: https://github.com/h8man/NavMeshPlus
Advertisement below: