Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Player Goes inside 'Platform with Box Collider' if velocity high enough

Discussion in '2D' started by mayIHaveThisDance, Feb 12, 2018.

  1. mayIHaveThisDance

    mayIHaveThisDance

    Joined:
    May 20, 2016
    Posts:
    38
    So The Problem is that i have a platformer in which the player dashes some distance.. But, if i dash close to a higher platform or into a wall or steps.. sometimes my player goes 'Inside' it breaking through the Box Collider. How do i fix that?? Here's an example - (Normal and inside Platform Pics)



     
  2. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    966
    Can you paste pictures of your RigidBody settings (for both - character and platform)?
     
  3. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    747
    Are you using FixedUpdate() for your physics updates? Have you tried setting Collision Detection to Continous in your Rigidbody?
     
  4. mayIHaveThisDance

    mayIHaveThisDance

    Joined:
    May 20, 2016
    Posts:
    38
    I Didn't Want to use Continuous cause i read that it degrades performance a lot

    Here they are !! (They are all Unity default.. i didn't change anything)



     
  5. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    747
    That is certainly true. But for a single object, such as your player, it shouldn't make a difference. It is well worth trying out to see if it fixes your problem.

    Are you moving your player via AddForce or .veclocity?
     
  6. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    966
    That's the problem. As @PGJ said, swich collision detection to continuous.


    Well, let's take a philosophical perspective.
    "Degrades performance" compared to what? Falling through the floor. :D
    And don't prematurely ejacu-... optimize.
     
  7. mayIHaveThisDance

    mayIHaveThisDance

    Joined:
    May 20, 2016
    Posts:
    38
    im moving player with velocity but Dashing is with AddForce

    So do i need to change collision detection to continuous for Only Player or Platforms too??

    I Also read to decrease fixedUpdate time to 0.005 or something.. i know it degrades performance even further.. but just for the sake of it i tried it... but then i could'nt jump... my jump functionality fails an di have to put it back to 0.02... why is that ?!!

    PS - the jump is working.. but the force is like lessened.. like in 0.02 800 force upward is equal to 3000 in 0.005 why is that?!!
     
  8. FMark92

    FMark92

    Joined:
    May 18, 2017
    Posts:
    966
    I don't know exactly how collision detection is calculated in Unity but logically, since player is the force exerting entity in this case, I would assume that just having continuous collision detection on player is enough.
     
  9. PGJ

    PGJ

    Joined:
    Jan 21, 2014
    Posts:
    747
    It should be enought with continous on the player.

    Are you doing a GetButtonDown (or similar) in FixedUpdate()? Those don't work there, they only work in Update(). Putting them into FixedUpdate() will result in missed button presses.
     
  10. mayIHaveThisDance

    mayIHaveThisDance

    Joined:
    May 20, 2016
    Posts:
    38
    GetButtonDown is in update...

    But ground check is in fixedupdate...
    could that be the issue??