- Home /
Sprite ignoring collison
Let me set up the situation first: I have 2 characters on the map that I have loaded into the game that move the exact same time. Suppose character 1 is at 1,0 and character 2 is at 0,1 and both want to move to 0,0. The collision detector that I learned from Tutorial RogueLike is allowing them to both move into the same space at the same time. Any Idea how to be able to test for this and stop it from happening. I have thought about giving them different time to move but unrealistic in my game as I could have thousands of characters moving around on a screen.
Answer by Ctnightmare · Jul 08, 2018 at 01:40 PM
I have been able to solve this by creating a List for destination taken by character and during the collision detection I check if anyone else is planning on moving to that destination. If not then add the destination to the List and move there.
Your answer
Follow this Question
Related Questions
Object passes through collider even when isTrigger is turned off. 2 Answers
Collision Killing CPU/FPS/Performance - Suggestions?! 0 Answers
Collision point problem 1 Answer
OnCollisionEnter2D doesn't work every time. 1 Answer
Best way to manually calculate collision between GameObjects and a Tilemap without using physics 1 Answer