Search Unity

Question Problem with enemy colliders and player attack's collider

Discussion in 'Physics' started by c1nnamonroll, Feb 3, 2024.

  1. c1nnamonroll

    c1nnamonroll

    Joined:
    Oct 31, 2023
    Posts:
    2
    I have made 2 enemies, one is in a spawner (therefore a prefab) the other is not. Each has their own collider 2D and rigidbody2D. My player's attack is a prefab as well. The attack and the enemy prefab collide just fine, however the attack goes over the other enemy which is not in a prefab and does not interact with it in any way. I have connected the same script to both enemies. What could be the problem? Is it a code thing or something with the collider's settings that I have missed. I have is trigger checked on both enemies but not on the attack as it does not show up if it is checked (I would have assumed that it just interacts with the player's collider but it does not show up on the hierarchy during game mode so I guess it's not that).
    I hope I managed to explain my problem so that you can understand me. Thank you in advance.
     
  2. c1nnamonroll

    c1nnamonroll

    Joined:
    Oct 31, 2023
    Posts:
    2
    Turns out the Rigidbody caused a problem. I had set it to static as I had no plans of making that enemy move. I changed it to Kinematic and now it is totally fine. It wasn't the colliders after all.