Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

What Controller/Collider should I use?

Discussion in 'General Discussion' started by MichaelCR97, Mar 1, 2021.

  1. MichaelCR97

    MichaelCR97

    Joined:
    Feb 14, 2021
    Posts:
    2
    Hello guys!

    I am currently implementing a 3d ski jumping game.

    I tried using a rigidbody + box collider on the character itself. The "terrain" has a mesh collider. Both have an own physics material without bounciness and with a friction of about 0.6. Char mass is 80.

    My current state is: The gravity places the char properly on the inrun. But as soon as I add a forward force to the rigidbody by .AddForce, the char is flying off the inrun, instead of "sliding" in it. What can be the cause? I already tried adding a smaller force, but then the char is VERY slow..

    Now I am wondering, whether my setup (rigidbody + those colliders) is the best for this use-case? Or should I maybe go with a character controller (self-implemented?) or even char physics (I have read of that somewhere)? Are just my colliders wrong?

    Keep in mind that - despite the inrun - the char also has to handle a jumping force properly and then keep flying, where a wind force should also have some influence. The landing should also happen without any bouncing.

    Thanks in adcance, any tips are well appreciated and surely helpful! :)
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,877
    Are you adding a relative force or just forward force? You want to add a force that is relative forward, not just forward. Otherwise the force is pointing into the sky, when the character is on a slope - which would make you fly off it ofcourse.

    Alternatively you can get similar behaviour by adding force as you do, and then adding a downward force too in addition.
     
    MichaelCR97 likes this.
  3. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,324
    Online source says that friction coefficient with snow is 0.03 and not 0.6. Given how ski works, however, it is likely that you'll need to implement custom handling of forces unless the game is 2d.

    Additionally, like @MadeFromPolygons , the force need to be directed along the ground. If you direct it forward the character will accelerate forward, and start flying and then fall.
     
    MichaelCR97 likes this.
  4. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    If physx was perfect you shuldnt needed to add any force at all :p

    edit: unless you want to simulate the skier is using his ski poles to add forward force
     
  5. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,877
    Yeah but as we all now physx is far from perfect :D
     
  6. MDADigital

    MDADigital

    Joined:
    Apr 18, 2020
    Posts:
    2,198
    yeah :p Tell me about it :p Trying to get joints stable for example
     
  7. MichaelCR97

    MichaelCR97

    Joined:
    Feb 14, 2021
    Posts:
    2
    @MadeFromPolygons That works, thanks a lot! Though I still dont understand, why the character was flying off the ground that fast and that straight upwards (and very far..).

    Anyways.. So I can readily stick to the rigidbody to implement the other components of the game?
    "The char also has to handle a jumping force properly and then keep flying, where a wind force should also have some influence. The landing should also happen without any bouncing."
     
  8. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,877
    Yes you can implement everything using rigidbodies for physical things

    Also, the reason it was flying up so much was because if you think about it, if you are giving an amount of force forwards on a slope continuously per frame, it ends up acting like a thruster and ofcourse will send you off the ground. So it was like you had a rocket strapped to your back :D
     
    Last edited: Mar 2, 2021