I am developing a game which needs an accurate collision detection algorithm, when an object travels down a slope which isn't flat. To be more precise I need to simulate a skier who travels down a ramp.

My first idea was to create simple bounding box around the skies and the ramp. Then place the skier in mid air and start calculating gravity. When the two bounding boxes intersect => collision detected (this is how I did it in 2D). But the problem is that the skies are flat and the slope isn't. So there is a chance that the ski will stick into the jump (due to curved surface of the jump) or even worse the skier will go under the jump (I don't want the skies to "sink" into the jump as well) .

What would be the best way of solving this? What I could think of is:

  • when collision is detected, rotate the skies until the front and the back end of the skies are colliding with the surface.

Is this idea any good? Did any face this kind of problem? Would be better to morph the skies according to the slope (but this would probably be an overhead I can't afford)?

P.S. if I didn't explain enough, write a comment and make a sketch.

  • 3
    \$\begingroup\$ I think newton can actually handle problems like this - why not take advantage of someone else's man-hours? However, what you could do is put wheels on the front and back of the skis (obviously you don't render them). In game physics you often approximate stuff like this. \$\endgroup\$ – Jonathan Dickinson Dec 12 '11 at 21:53
  • 1
    \$\begingroup\$ Does the course on the jump involve any actual jumping (before the end) or hopping? I agree with @JonathanDickinson, your collision primitives should be two wheels (or cylinders) at the front and at the back of the skis, and when both wheels are touching the ground and where the jump has negative curvature (it is possible that it hasn’t at the very beginning I guess?) you should project the skis to the ground because the skier’s weight and the fictitious centrifugal force do exactly that in real life! \$\endgroup\$ – sam hocevar Dec 12 '11 at 23:50
  • \$\begingroup\$ yes there will be jumping (at the end of the jump). if the user will push a button at the correct time the skier should jump even further. So if i understand correctly i should add 2 spheres on the skies (at the front and at the back) and check for collision between the jump collision mesh and the spheres? should the spheres also spin (like a skateboard)? What do i need to do when i detect a collision at the front of the skies (push it upwords)? would appreciate a detailed explanation. Thanks! \$\endgroup\$ – jernej Dec 13 '11 at 17:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.