Search code examples
c#unity-game-enginegame-physics

How to determine if there is an object lying on the Plane at particular coordinates?


I am implementing A* algorithm in 3D environment and I have came to a point where I need to determine whether there is something lying on a plane (on which my characters will be walking) at particular coordinates.

I have created a class Board which holds the map of of Nodes (each holds center of its coordinates). So we can say I have discretized the Plane to something similar like a chessborad. Now I need to know whether there is something on each Node to create a walkable/unwalkable map on this plane.

How can I do this in Unity3D ? Raycasting ?

EDIT

There is one thing that I can think of but I think it's a bit inefficient :

Create a temporary collider ( take area of Board's tile and some height ) and check whether there is something colliding with it and then keep translating it for every tile in the Board.

Do you think this would be a good way ?


Solution

  • Thanks to Ghopper21's answer I came up with ShpereCasting each Node from above it e.g. Node (0,0,0) would be Spherecasted from (0,100,0).