# Well, the snow is falling here in UT. It's ski season, lets simulate it.

I want to create a snowboard/ski simulation that is as realistic as practical. I get the basics of the game engine, but I don’t have much experience with it. I’m probably going to have to write some python for all this. I’ve written a couple programs with python long ago, but nothing related to Blender.

I’ve found a few resources about the math behind skiing and carving through snow. As I do more research, I’ll keep this thread updated.

So my first question is, how do I find out what direction is downhill? I assume it is not very difficult to get the normal of the mesh at a given point. So if I place a ball anywhere on a mesh, how do I find out which way it will start rolling?

Knowing which way is downhill, or the direction of the forces of gravity and resistance of the ground, is very important.

My first idea is to have a tiny sphere that can roll around on a mesh and parent my model to that and keep the plane of the snowboard equal to the ground and the center of mass of the snowboarder directly above the center of the ball. From there I can add more detail.

Any help with this simulation is appreciated, and feel free to talk about skiing and snowboarding. (I’m hoping to get out this week and do some cross country)

Use the object’s rayCast function to test a direction - check 22 degrees (or a smaller grade) in two directions (assuming all mountains go down on the X-axis). If one direction returns a collision and the other doesn’t, then the other direction is downhill (and then you’ll know). That idea with the tiny sphere should work.

One ray already provides the necessary informations:

Awesome, thanks for the info on rays. That will come in handy.

I just read an article: “Physics of Skiing: The Ideal-Carving Equation and Its Applications” by U.D. Jentshura and F. Fahrbach from U. of FreiburgIf you understand physics and you like skiing, it might be a good read on it’s own and could even improve your performance.

I’ve also order some books from the library on ski physics and should be getting them soon. I think I’ll write up a paper on the whole subject.

Back to rays. Does the raySource have to be a lamp or other emitter? Am I correct that area lamps send all parallel rays? Would using a mesh emitter be better? Is this how you would trace a bullet in a shooter?

Lamps don’t inherently send rays- light calculation and rays are entirely unrelated. Any object can send rays, and if you use python they can cast the ray from any point to any point, or in any direction. If you use the logic brick it will cast the ray along the axis of your choice. If you’re using a character, I recommend casting the ray from the parent object (IE the physics bounds), in the character’s local -Z direction. You can also use the same ray to align the character to the surface, so the skis/board are flat to the ground.