Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Problems with unity tile-map collider 2d

Discussion in '2D' started by sirjacobgoodrich, Oct 23, 2019.

  1. sirjacobgoodrich

    sirjacobgoodrich

    Joined:
    Jul 27, 2019
    Posts:
    12
    I'm having trouble with the tilemap collider 2d, my player simply passes through the things I have the collider on. The player has a rigid body 2d(set to kinematic mode) and a box collider 2d.

    also I wrote a control script for him, so here it is just encase.



    p.s. thank you unity users for being so helpful on my other posts!
     

    Attached Files:

  2. DWriedt

    DWriedt

    Joined:
    Oct 7, 2019
    Posts:
    2
    https://learn.unity.com/tutorial/wo...-movement?projectId=5c6166dbedbc2a0021b1bc7c#
    Ruby's Adventure 2D
    World Interactions - Blocking Movement
    step 9 there's some code that might help. If not the code, maybe something in that section will help. It goes over tile map colliders.

    Noticed you had movement code in the FixedUpdate section. That will make movement sporadic according to a few sources that I've read.
     
    Last edited: Oct 24, 2019
  3. Tristan73

    Tristan73

    Joined:
    Jul 20, 2019
    Posts:
    2
    I think you must set your player rigidbody2D to the Dynamic type, instead of kinematic, to have collisions work with the tilemap collider Rigidbody2D type kinematic. At least that works for me.

    Would be appreciated if someone could explain why you cannot have collissions between the player Rigidbody2D type kinematic and tilemap collider Rigidbody2D type kinematic.
     
    mpodlesny likes this.