Search Unity

I need Rigidbody Character to slide down to the ground.

Discussion in 'Physics' started by Volchok, Aug 12, 2019.

  1. Volchok

    Volchok

    Joined:
    Jul 26, 2017
    Posts:
    127
    Hello!

    Sorry, my English is not so good!

    Why person above does not fall down with sliding along capsule collider top (not stable convex surface)?

    I set gravity: Physics.gravity = new Vector3(0f, -9.8f, 0f);

    I think it should be automatically...

    Should I use AddForce(-transform.up) to see falling down or something else?

    I seems, Character Controller Component creates this automatically, but I need Rigidbody.

    Thanks!
     

    Attached Files:

  2. Aristonaut

    Aristonaut

    Joined:
    May 4, 2019
    Posts:
    15
    If the two people are perfectly lined up, then the top person is standing on a flat surface and will never slide.
    If you put the top person offset a bit, they should slide. If not, then your gravity is probably too weak to counteract the default physics material friction.
    If you want a workaround, you could do it in the collision check. You could make it so that if you land on another person and the collision normal is close to straight up, add a tiny bit of force in some direction.
     
    Volchok likes this.
  3. Volchok

    Volchok

    Joined:
    Jul 26, 2017
    Posts:
    127
    Thanks! I increased gravity to 50 and saw sliding and falling... I understood, I could increase gravity, but can not do this more than 50 - character jumps depend on it... I can AddForce() a little bit - good solution! But changing material friction force is the better solution! How can I change friction force of material? In Capsule Collider-->Material? To create Physics Material, set a specific friction force and drop it into this field? Am I right?
     

    Attached Files:

  4. Volchok

    Volchok

    Joined:
    Jul 26, 2017
    Posts:
    127
    I created Physics Material, set it into Capsule Collider-->Material, set Static Friction and Dynamic Friction to 0... And if I shift a little bit, see fast sliding and falling... Thant is excellent! But I suspect that is not good for characters If they moving on rocks and grounds... Am I right? There is only one good solution - no physic material - just AddForce() if the character stands on the character...
     
  5. Volchok

    Volchok

    Joined:
    Jul 26, 2017
    Posts:
    127
    I created checking method on base of Physics.Raycast() and AddForce()... And physics material I use also... The question is closed!

    Thank you for your cooperation! ))
     
    Last edited: Aug 13, 2019