Alice Community Collision Mission! (Part 1: Hill Detection)

reuben2011
Senior Member

Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
03-07-2011, 11:14 AM

Quote:
 Originally Posted by David B I don't see why collision detection is so exciting. It is very easy to do.
Have you viewed the program? If you look at my code, you will see that this program is more complicated than regular collision detection. I had to use a deviation of both the circle formula ((x-h)^2 + (y-k)^2 = r^2) and the Pythagorean theorem (a^2 + b^2 = c^2) in order to move a object smoothly over a spherically shaped object.

Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects

 arty-fishL Senior Member     Status: Offline Posts: 1,878 Join Date: Mar 2008 Location: In the corner of your eye 03-10-2011, 04:03 PM why couldn't you just use y = a COS( b x ) where a is the height (or amplitude) of the hill b is the width (or period) of the hill x is the distance to the centre of the base of the hill and y is the resulting height of the colliding object relative to the hill EDIT - that would be for the hill object in the object gallery, for a different shape of hill you could calculate it like a basic parabola. █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ █░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█ █░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█ █░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█ █░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█ █░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█ █░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█ █░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█ I have mostly moved on from Alice, but may still respond to messages if important [¬º-°]¬ Last edited by arty-fishL; 03-10-2011 at 04:07 PM.
reuben2011
Senior Member

Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
03-10-2011, 10:52 PM

Quote:
 Originally Posted by arty-fishL why couldn't you just use y = a COS( b x ) where a is the height (or amplitude) of the hill b is the width (or period) of the hill x is the distance to the centre of the base of the hill and y is the resulting height of the colliding object relative to the hill EDIT - that would be for the hill object in the object gallery, for a different shape of hill you could calculate it like a basic parabola.
Well, the curvature of the hill doesn't exactly fit a cosine curve I believe. Would you like to edit my example and post your own. Maybe then I can understand. Also, Alice doesn't have an built-in function for calculating the "x" in your equation.

Projects
-Escape the Kitchen
-That ninja animation
-Hill Collision

Upcoming Projects