Search Unity

Ski Physics

Discussion in 'Physics' started by NickWu, Mar 30, 2016.

  1. NickWu

    NickWu

    Joined:
    May 7, 2013
    Posts:
    6
    Hello everyone.

    Does anyone have experience on creating skiing physics?
    I'm currently working on a training scenario for a ski-chair, but having problem on creating a believable skiing experience.
    The purpose this game is to help player to get use to the ski-chair control and have a good idea how should they handle different terrain when they are on the actual ski-chair.
    And since it is a ski-chair, it drives more like a vehicle, the only control available to the player would be adjusting the ski angles.
    i.e. no jump-turn, no leaning steer, etc.
    photo.jpg
    For that reason, the game doesn't need to 100% physically accurate, but still need to be able to present most of the basic physics attributes of a ski chair.

    My first attempt was to use a car prefab to fake the skiing physics by taking out the engine, adding braking force when the ski is in "/ \"(pizza) shape, lower braking force when the ski is in "| |"(french fries) shape etc.
    The result was not great, but acceptable back then.



    And as the project moved on, we migrated from Unity 4 to Unity 5, which drastically changed the physics properties, and the old settings are no longer usable.

    So I took that chance to try to create my own skiing controller script.
    But since I only skied for a couple of times in my life and most of my physics knowledge were gone with the years, I was struggling on this task.

    So this is what I did:
    Setup the physical material of the ski so it has really low dynamic friction, so the ski-chair will now slide down the slope due to gravity.

    And then I separate the gravity force into different forward and side-way components, so I can apply higher drag on side-way component to make the ski-chair doesn't slide side-way too much.

    That's the basic part for the ski-movement, pretty straight forward, but what's been bothering me a lot is the steering part.

    There are so many different factor that affect the steering, here are the ones that I came up with (probably not correct):
    • The ski angles (they have different turning radius depends on the current ski condition, i.e. pizza, french fries)
    • Current velocity of the ski-chair, i.e. ski-chair in stationary shouldn't be able to turn, higher speed should result in lower steering efficiency
    • Local Slope
    • Fall-line Slope
    • Fall-line Direction, i.e. when the ski-chair is running down hill without active steering, the ski-chair should steer itself towards the direction of the Fall-line
    I calculate the steering force base on above factors and a bunch of magic numbers and then apply them by AddRelativeTorque().

    This is where I'm currently at:



    The result is acceptable, but the steering still feels a little bit off.
    I'm wondering if I missed any important factors, or is there a better way to implement a skiing physics.

    Any help or advice would be greatly appreciated.
     
    Last edited: Mar 30, 2016
    Kjelle69 and unity-nikkolai like this.
  2. Kjelle69

    Kjelle69

    Joined:
    Nov 9, 2016
    Posts:
    53
    I think it looks fantastic, how did this project come out in the end?
     
  3. ugal

    ugal

    Joined:
    Feb 15, 2020
    Posts:
    7
    Hi and sorry for getting this thread out of the past but im trying to do a little ski game but i have very little experience in all this
    I already manage to make my player go forward when i press up and to add drag while i press down
    and also to rotate according to his local Y axis in order to turn BUT here comes my problem i have been searching for a few days but i can't find a way to restrict the players movement to his local Z axis so that when i rotate him using the left and right arrows he will then go in the right direction
    this would also limit his sliding down the slope to his local axis Z !

    i found the freeze position but it is regarding the world space and not the self space

    thanks in advance and I find this game amazing for the time it was published !!