Search Unity

Simulating snowboard (or sledge) physics

Discussion in 'Physics' started by sebastianzander, Oct 15, 2020.

  1. sebastianzander

    sebastianzander

    Joined:
    Mar 22, 2018
    Posts:
    37
    Hello good people of Unity,

    I currently work on a snowboard game as a student project. I am not quite sure about the arcade/simulation ratio. Because of that and because I always want to learn more about physics I want to make it physically as accurate as possible. I like the idea to simply work with gravitational potential, kinetic energy and (dynamic) friction using a Rigidbody component and Physics Materials.

    What I have so far is a snowboard with a Rigidbody component, reasonable physical properties and a custom script for adding natural and player control forces. With tweaked friction values my snowboard nicely slides down a slope, picks up and loses speed with respect to the gradient.

    But unlike a snowboard or a sledge the friction acts in all directions/axes equally and my snowboard takes turns down the slope along the path with least resistance. That is to say it of course doesn't respect the orientation of my "mesh" - how could it? I mean it respects the shape of the simplified box collider but that collider has equal friction on all sides and surfaces.

    Assume the following values for a common understanding:
    • let angle A be the horizontal deviation angle from perfectly downhill
      • A = 0° represents the snowboard pointing perfectly downhill
      • A = 90° represents the snowboard being perpendicular to gravity (absolute value not considering left or right orientation)
    In a perfect world without friction along the longitudinal axis and without other application of force the snowboard would rest at A = 90° but move at any value less than 90°. It would only move slower or faster depending on the angle. Due to friction along the transversal/lateral axis the snowboard will basically hold its line until stopped by another force. If you let the snowboard slide down with an angle A = 45° it would keep that angle. More than say 95% of the steering of a snowboard will happen by application of outside forces (i.e. the snowboarder exerting torque forces).

    I am yet to find an approach to realize this in Unity. My idea was to add gravitational acceleration myself and account for slope, snowboard orientation and friction with respect to orientation.

    As a further information I would like to control the snowboard via real forces and e.g. the AddForceAtPosition() method to add torque around the snowboard's center of mass and use that for steering, braking, carving, skidding.

    Does anyone know how I would approach the matter? I would be glad for any input or clues.

    Thank you in advance
     
  2. tjmaul

    tjmaul

    Joined:
    Aug 29, 2018
    Posts:
    467
    Assuming board.transform.forward is actually forward, you could simply project the rigidbodies velocity onto the transform.right axis. This operation yields the velocity component that points sideways.

    Add a force that counteracts this velocity. Eg:
    rib.AddForce(-sidewaysDamping * Vector3.Project(rb.velocity, transform.right))

    this will work nicely when moving, but won’t bring the snowboard to a complete stop if it’s 90 degrees.

    you could also look into the wheel collider with heavily adjusted friction values
     
  3. sebastianzander

    sebastianzander

    Joined:
    Mar 22, 2018
    Posts:
    37
    Hello tjmaul, thank you for your suggestion. This is exactly what I try to achieve, however finding the "force" is the challenge here. Adding unnecessary "artificial" forces where there are none in the real world cannot be the solution to my problem, so I assume that it must be friction. I have thought many times about it and my guess is that I have to treat static friction along the two axes (longitudinal and transversal/sideways) independently so that I simply don't add transversal acceleration forces when the transversal velocity component is too low to overcome static friction. That would theoretically eliminate unwanted sliding (deep snow scenario).

    I feel that I have to somehow redirect the momentum of the snowboard, because simply adding friction sideways slows the snowboard too much down. I have made some progress in that direction and will post to this thread once I have the sliding problem under control.

    I ruled the wheel collider out for my purposes because they won't fit in terms of their dimensions. I would have to add many many small wheel colliders to fill the snowboards shallow volume. That is something that I don't want to pursue since I want to attach importance to physical accuracy.
     
    Last edited: Oct 20, 2020