The Physics of Snowboarding and the Simulation Thereof
First, some required reading. I found a fantastic page all about The Physics of Snowboarding.
The first line of the article says,
A snowboarder typically gains speed by converting gravitational potential energy into kinetic energy of motion.
This is the most primary feature of snowboard racing physics and will be at the core of any snowboard physics simulation. This is why we can say that the physics of downhill racing is something like the physics of a marble rolling down a hill. If the marble has no ability to adjust its direction then it will behave like a snowboarding bombing it and riding straight down the hill. The snowboard has sliding friction whereas the marble has rolling friction, but otherwise it is the same.
The Wikipedia entry for Fall line says,
In alpine skiing, a fall line refers to the line down a mountain or hill which is most directly downhill. That is, the direction a ball would roll if it were free to move on the slope under gravity.
An improved simple model of downhill snowboarding is something like this :
The snowboard is a rigid body which is pulled by the constant force of gravity down an inclined plane. The local pitch of the slope determines the speed and acceleration of the snowboard as it travels down the mountain. Consider what would happen if you let a snowboard deck go at the top of a straight run with a long run-out at the bottom. It would accelerate according to the steepness of the hill and would speed up and slow down as the slope changed on its way to the bottom where it would finally come to rest due to friction after the slope levels out at the bottom.
Now let’s add the rider. The rider acts as another rigid body which can act upon the board to influence its direction and thereby it’s speed as the board travels down the mountain. In reality, the rider is actually a collection of rigid bodies (the rider’s skeleton) and the influence which the rider has on the board is the result of the rider adjusting the orientation of these bodies relative to one another. i.e. pivoting the legs or leaning from the waist. For the sake of our current simulation I think we can simplify our thinking about the problem by considering that the rider is a single entity which has the ability to influence the board in two major ways.
The rider can rotate the board about its Y axis (Yaw) and thereby adjust the amount of sliding friction acting on the board and therefore it’s speed. This is what we do when we side-slip a course. At is most extreme we might hop from toe to heel, slipping one way, and then another, always aligned perpendicular to the slope. We might also do this when negotiating very steep terrain. This is because we are generating the highest possible resistance to our speed down the mountain due to the maximum sliding edge contact we create by our 90 degree orientation to the fall line.
The rider can cause the board to lean up on its edge which causes it gradually to change direction as it travels down the slope. Given a constant slope gradient, this change in direction will result in a slowing of the board on its way down the mountain. Some of this is from sliding friction, especially if the rider is sliding his turns. In the case of a pure carve however, most of this speed decrease happens because as the orientation of the board changes relative to the slope, the local pitch of the slope relative to the direction of the board decrease. Consider that when the board has changed direction so that, by the bottom of a carved turn, it is sliding straight across the fall line, the local slope becomes flat. In addition, as the rider carves back and forth across the fall line, he is making his overall course longer than if he were to ride straight down. This way, the constant pull of gravity on the board is spaced out over the longer time it takes for the board to travel in a sinusoidal pattern compared with the case where it travels straight down the fall line.
A more complete model will factor in both sidecut and camber along with the deformation of camber throughout a turn. Kemper Bullets aside, just about every snowboard has some level of sidecut. That is, the profile of it’s edges traces out some portion of a curve many times longer than the board. In modern boards this curve may be more complex than that of a circle, but for our current purposes we can consider that it is that of a circle. When the snowboard is flat on the snow, the sidecut will determine the radius of the circle that the snowboard wants to travel in.
As the rider leans more and more on edge during the turn, the snowboard will tend to trace out an elliptical path. This is generally undesirable in racing and this is where camber comes into play. Boards are built with a certain amount of positive camber, that is, they are bowed up in the middle a little when lying flat on the ground. When the riders weight acts to deform this camber throughout a carved turn, the board ends up with some amount of reverse camber. This reverse camber helps to restore the desirable circular carve path that the board had when lying flat.
For now, I will recognize these last features but will not attempt to model them for the first generation of simulation.
The core of any snowboard race training experience worth making is that, at some level, it will feel like the real thing. Even if the physics are simple, they must be based on real world forces lest we end with an arcade game which does not help the rider to improve on the mountain.
When making a physics based experience in Unity there are two basic approaches to consider and many games end up using a hybrid of them both.
Unity includes a very powerful physics engine based on Nvidia PhysX. We can populate a world with objects that include rigid bodies and let the engine figure out how they should interact. In this case, the two essential bodies are the slope and the snowboard. I did a simple experiment and placed one plane at a 30 degree slope and then put a board shaped box at one end. Sure enough, I just hit play in Unity, and the board slides down the slope. The board's rigid body has parameters like mass and drag which can be adjusted to approximate the phenomena of a snowboard sliding down a snowy hill. I have yet to experiment further with this approach, and it may still prove the way to go. Next I might read the gamepad stick's input and use it to apply rotational force (torque) to the board such that it will adjust its direction. The Physics engine should step in and slow the board as it traverses the slope. This approach can tend to be hard to fine tune and to take control of because you never explicitly control the motion of the board, but rather the parameters of all of the bodies and forces in the world.
The second approach,and the one which I am currently using for the simple gate racing demo that I'm working on is to write a custom physics controller which controls the boards motion, frame by frame, using a simple set of rules devised for the purpose. I'm working with this method right now because I found some code somebody posted which gives a workable model. I'm not sure yet if this will prove the way to go.
The current simple model works like this. For every frame :
- Calculate the slope of the board. Sample either end of the snowboard and determine the slope of the line.
- Calculate the slope of the mountain. Sample the four corners of the snowboard and determine it's slope based on the surface normal of the resulting polygon.
- Use the normal to calculate the acceleration and lean of the board
- Calculate acceleration and forward velocity based on the slope of the mountain
- Calculate the new heading from the turn angle
- Calculate board's total rotation based on the slope of the hill, the snowboards heading, and its turn amount
- Update the board's position based on it's forward velocity
Next, I will perform some simple tests to see if I am able to get similar results using the first approach because I think it holds more promise as a means to achieve a realistic feeling simulation.