Support Forum

Layered Grid - Handling multiple layers on single mesh collider

Hello! Hopefully this is the correct place to ask a question. I am trying to use a layered grid graph to handle multiple layers and it work great as long as the different layers are caused by different collision meshes. When I have a single collision mesh with multiple levels, however, the ray only returns a single collision. What would be the best way to go about addressing this (the mesh is procedural and decimating isn’t really an option at this point).

Thanks!

Looks like this is already known:

		/// <summary>
		/// Returns all hits when checking height for position.
		/// Warning: Does not work well with thick raycast, will only return an object a single time
		///
		/// Warning: The returned array is ephermal. It will be invalidated when this method is called again.
		/// If you need persistent results you should copy it.
		///
		/// The returned array may be larger than the actual number of hits, the numHits out parameter indicates how many hits there actually were.
		/// </summary>

Going to try porting this over to RaycastAll

Well, it looks like it already uses Physics.RaycastNonAlloc which should return multiple results ala Physics.RaycastAll…

Back to the drawing board.

Hi

Are you sure you are not using thick raycasting in the grid graph settings? That mode can in some cases cause this behavior I think.

Hi Aron,

I am not using thick raycasting. Enabling that option with Layered Graph gives a warning.

https://imgur.com/gallery/OrU0O6l

The plane on the left is a different mesh and both the top and bottom are detected by the A*. The cubes on the left are a combined mesh with the terrain below and only the top is detected by A* (Minecraft-esque voxels).

Old post but I had the same issue and fixed here: