PDA

View Full Version : Calculating height for a ball moving down a hill



chronophile
04-25-2011, 03:41 PM
Hi there. I'm working on a minigolf game for a class project and one thing I want to do is make my ball roll up and down sloped hills. The hills are simple rectangles and I have normal vectors for each one. The easy way seems to be taking the normal and making a perpendicular axis to it and setting the ball along that axis. I'm not quite sure how to go about that though.

Any ideas?

chronophile
04-25-2011, 04:13 PM
I'm guessing i can take the angle of the normal translate my ball to the origin, roatate and translate back?

McLeary
04-26-2011, 10:02 AM
Does your objective is simulate the ball position or do you wanna simulate a real ball behavior?

For the first case, all you need is basic physics (URM (http://www.outlab.ie/forums/documents/fm/mechanical_phenomena_uniform_rectilinear_motion_ph ysics_en_up_ro_162.pdf)). For the second case, you need to implement friction (http://en.wikipedia.org/wiki/Friction) that generates torque (http://en.wikipedia.org/wiki/Torque) which will be applied on the ball.