# How to tell what type an object is for collision-detection with a spatial partition?

I have been following this tutorial: http://gameprogrammingpatterns.com/spatial-partition.html that essentially creates a grid of cells. Each cell contains a doubly-linked list of Unit objects, and each cell is processed for collision checking.

In my code, I have an Entity class that is the base class of many different classes, like Wall, Player, Bullet, etc. In this case, however, if I use a doubly-linked list of type Entity, I am not exactly sure how I'd be able to tell that an Entity is a Wall or Player, for example, so I wouldn't be able to handle the specific collisions I want to.

Is there a way to handle these collisions that I'm missing?

• I am confused as to why you have the collision-detection tag. Are you looking for ways to implement collision detection, or are you looking for ways to identify your Entitys? – Alex F May 26 at 18:02