- Home /
I need help with collision detection in my 2D chess project
Hi all,
I'm in the middle of working on my 2D, top down chess game and I need a new way of figuring out which moves a piece can make.
This is my new system: I have an empty game object with a collider2D and rigidbody. Each tile on my chessboard has its own collider2d. Basically, I want to be able to move this gameobject (named TileDetector) a certain amount of times, and whenever it hits a tile, I want to be able to detect that. For example, say there is a black pawn at its starting position. That means it can move down up to two tiles. I make the tile detector move down a tile at a time, and each time it moves, I loop through every single tile in the board and detect if it is touching this object. If it is, I add the tile to a list and then somewhere else in the program I light up all the tiles in the list.
It isn't working. How do I get an empty game object (TileDetector) to detect collisions with other gameobjects that only have colliders on them? I tried putting a rigidbody along with the collider on the TileDetector but when I do that, it gets pushed around by the physics system because it teleports inside of colliders.
Is there a better way to do this? How can I get my tiledetector object to correctly detect collisions, without being pushed around by the physics system?
Thank you so much.
Your answer
Follow this Question
Related Questions
Collider Question 1 Answer
OnTriggerEnter2D often not called 1 Answer
Composite Collider on Tilemap not really stopping player 0 Answers
getting udp package info inside unity (GlovePIE) 0 Answers
Unity 2D - Game Collision Bug Error 0 Answers