Search Unity

Question Rigidbody colliding with Child Collider on Jump

Discussion in 'Physics' started by Janniqz, Jun 4, 2020.

  1. Janniqz

    Janniqz

    Joined:
    Sep 7, 2018
    Posts:
    3
    First time poster & relatively new to Unity Physics here!

    I've been experimenting with being able to stack multiple Player Prefabs (You can switch between them) on top of each other. Due to the main Player Collider currently being a CapsuleCollider (Still very much WIP), other Prefabs would slide off of it and therefore I created another separate Collider GameObject on a different Layer that sits on at the highest point of the Capsule (BoxCollider).

    2020-06-05 00_05_49-Window.png

    When trying to jump with this second Collider attached I've noticed that I'm hitting a non-existant ceiling which is said Collider. The Jumping itself isn't anything special, simply relying on some added upwards Force.

    Whilst the entire problem seemed rather odd to me as the Collider should be moving up with the rest of the player, I've tried multiple ways to fix this:
    - Disabling Collisions between the Player & the "Stacking" Collider (Via Layer Matrix) -> No Change
    - Disabling the Collision between the two Colliders (Physics.IgnoreCollision) -> No change

    (The Players Colliders total height is 2)
    - Setting the Position of the "Stacking" Collider to 1.98- -> Works fine
    - Setting the Position of the "Stacking" Collider to 2.06+ -> Works fine

    None of this really helped me understand the problem here. Especially the Layer Matrix not changing anything seemed kinda weird to me.

    So now I'm stuck with either not being able to jump correctly or having a gap between stacked Players.

    If anyone has any ideas I'd appreciate the help! I'm not quite sure what further Information would be good but I'm glad to provide!
     
    Last edited: Jun 4, 2020