0

My Player just goes through stuff he actually shouldnt be able to go trough like enemies or map borders, which all have collider components attached to them.

It's really annoying because I haven't changed anything and sice yesterday, but it isn't working anymore. It's especially annoying because Enemies cant even hit me anymore.

Is there a better way to use colliders? I would be really thankful for some help on that. If you need more specific infos just write comment.

DMGregory
  • 134,153
  • 22
  • 242
  • 357
Hammynator
  • 33
  • 9
  • Your player has collider and a rigid body of the matching type? You didn't change anything in the collision matrix? How do you move the player? – Zibelas Jan 08 '23 at 12:13
  • You have not given us enough information to diagnose this problem. Please edit your question so that it contains a Minimal Complete Verifiable Example of the problem. That is: every line of code and step of scene setup instruction that a reader would need to follow to reproduce this problem in a new, empty project. Once we can reproduce the exact issue you're having, we can test potential fixes to be sure they'll work for you. – DMGregory Jan 08 '23 at 13:21
  • You may also want to look at past Q&A like Object goes straight through game object without colliding, Car driving through walls with transform.Translate(), etc. Common contributors are missing Rigidbodies, moving objects with the Transform component instead of the Rigidbody component, mixing 2D and 3D colliders, colliders set as "Is Trigger", kinematic bodies being used to disable automatic collision resolution, etc. We'd need to see your implementation to know which causes are relevant. – DMGregory Jan 08 '23 at 14:20

1 Answers1

1

The problem was simply because my Rigidbody2D was set to be Kinematic, which led to it being totally immune to physics interaction, meaning it could not collide with anything.

To fix this issue, just set your Rigidbody2D (back) to Dynamic.

DMGregory
  • 134,153
  • 22
  • 242
  • 357
Hammynator
  • 33
  • 9
  • Thank you for your edit. After a short delay you'll be able to mark this answer as "Accepted" by clicking the ✅ icon in the top left, to signal to other users that this answer correctly solves the problem. – DMGregory Jan 08 '23 at 17:09