Easy Collider issue
I'm making a game and I have two colliders on my player (box and circle) whenever I get a coin in my game it adds 2 instead of one. I think this is because the two colliders are hitting the coin at the same time when jumped at a certain angle. But idk how to go about fixing that. Can someone please help me this is due today and I'm really freaking out. Thank you so much!!!
Answer by mbro514 · Jul 04, 2020 at 03:36 PM
I'm pretty sure that you are correct about the cause of your problem. As for a solution to it, I could think of 2 that would work.
Get rid of one of the colliders and expand the other one to take its place. This is definitely the easier of the two options, but it may not be a good choice for the game you're making.
You could try using a Physics Query (such as Physics2D.BoxCast) and cast into the scene in the direction that you're going to move and set the distance to the distance that you're going to move. Then check each GameObject that was hit, and if it's a coin, then collect it.
P.S. Sorry that this is a little late. I hope it's still useful.
Your answer
Follow this Question
Related Questions
Setting points of edge collider 2D from script 0 Answers
Trigger Collinder doesnt work with Input.GetKey 1 Answer
How do I make Polygon Collider 2D more smooth? 0 Answers
Make Blocks stay in the grid 0 Answers
Problem with Strings updatings on Gui 0 Answers