Alice Community  

Go Back   Alice Community > Alice 2 > Works-In-Progress

Reply
 
Thread Tools Display Modes
Collision Mission! (Part 1: Hill Detection)
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Cool Collision Mission! (Part 1: Hill Detection) - 02-19-2011, 05:51 PM

So anyway, since collision detection is a main subject on Alice, I thought it would be a good idea to start a miny project involving creating engines/demos that showcase collision detection and other physics-related events.

Anyways, I made this Alice world that is able to detect hills and allow objects to move smoothly over them.

Anyways, fyi, I used zonedabone's collision detection engine, figuring it had a lot of things on it that I wouldn't need to recreate, like the object arrays, some variables, the maintenance script, etc. So zonedabone: thanks a lot! Also, I added to documentation (aka comments), including the parts that zonedabone coded, so hopefully people can understand it a little better.

Anyways, feel free to use the code, or implement the world into your own game, as long as you give me credit I am open to suggestions and I already have a "to-do" list that can be seen in the documentation in the world. I'll be editing this original post to add any updates or new versions.


PS Zonedabone: Feel free to "upgrade" the program in any way with your awesomeness (there are some other maintenance issues).

EDIT: Just realized this is my 100th post! Woot! XD

EDIT2: Ok, just added the world! Feel free to look! Don't mind the file name, I couldn't think of a good name. lol Btw, if you want the hills to look realistic, you can just change the sphere's texture to the ground's. Also, you can add more hills simply by adding more spheres (that are sunken into the ground) into the hill array.

Notes
-As of right now, only hills in the shape of perfect semi-spheres work. I am working on "shallow hill.s"
-The ball is going down via a loop that moves the ball down. You can try to tweak the length and time parameters so get a smoother effect. On one extreme, it will appear as if the ball is vibrating and on the other extreme, the ball might just "fall" off the semi-sphere. You can interpret that as a bug, or gravity, whatever you wish. =D

To-Do List
-Shallow hills (not just semi-spheres)
-Calculating slope of hill to allow things to rotate accordingly (such as a car driving on it. You wouldn't want the car to be parallel to the ground the whole time.)
-Implementing offset variable since some objects have a "center" that touches the ground
-Allow main object to move correctly at hill intersections (like if we put the two hills together such that parts of the hill are within each other. Would make for good "rolling hills" effect.)
-Change main object to an array of main object's'
-Let me know!
Attached Files
File Type: a2w hello.a2w (519.8 KB, 88 views)

Last edited by reuben2011; 02-21-2011 at 08:49 PM.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Thumbs up 02-19-2011, 05:59 PM

Zenteos terrain builder had perfect collision on its surface:
on this thread

100 posts, first benchmark.


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [¬º-°]¬
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 02-21-2011, 03:54 AM

Interesting, I'll take a look at the terrain builder once I'm off from vacation and I have access to my laptop with Alice on it. I want to see how the collision detection works on it. ^_^

Anyways, I should have the world up by Monday. Well the positives with this, (as opposed to terrain builder), is that it would be a lot quicker of you want to work with hills that were in the shape of a sphere cut along some horizontal axis (semi-sphere or less.) It'll make sense when you guys see it. Plus, I didn't use any heightmaps or anything (I want to see how that works in terrain builder though), just some algebra. I basically worked off of the formula for the graph of circle since a sphere is basically a circle revolved about a plane.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 02-21-2011, 09:24 AM

Quote:
Originally Posted by reuben2011 View Post
So anyway, since collision detection is a main subject on Alice, I thought it would be a good idea to start a miny project involving creating engines/demos that showcase collision detection and other physics-related events.

Anyways, I made ...

Anyways, I'm on "vacation" [...]

Anyways, fyi, I used [...]

Anyways, feel free [...]
You use the word "anyways" a lot haha. Well I'm looking forward to seeing how you do your version of collision detection with hills.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 02-21-2011, 08:51 PM

Quote:
Originally Posted by Dameria View Post
You use the word "anyways" a lot haha. Well I'm looking forward to seeing how you do your version of collision detection with hills.
I noticed that (the "anyways.") Haha. Anyways, (lol) I just added the file. See the original post for updates. Look under "edit2", "notes", "to-do list", and "attached files" for the stuff I just added. Enjoy!
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 02-22-2011, 03:08 PM

Sorry for double posting but... has anyone taken a look at the world that I posted?


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

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 02-28-2011, 10:55 AM

No comments? (^bump)


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

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
AJMansfield
Guest
 
Status:
Posts: n/a
Default 03-07-2011, 10:22 AM

the system way up near the top w/ the hills, if the circle formulas were replaced with functions containing those formulas (so we never actually see the formula, and hence have less chance of messing it up), the code would become much more maintainable.
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 03-07-2011, 10:46 AM

Quote:
Originally Posted by AJMansfield View Post
the system way up near the top w/ the hills, if the circle formulas were replaced with functions containing those formulas (so we never actually see the formula, and hence have less chance of messing it up), the code would become much more maintainable.
I'll try to clean up the code for the next version that I make.


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

Upcoming Projects
-Some penguin adventure game?
   
Reply With Quote
Old
David B
Senior Member
 
David B's Avatar
 
Status: Offline
Posts: 1,145
Join Date: Dec 2010
Location: N/A
Default 03-07-2011, 10:47 AM

I don't see why collision detection is so exciting. It is very easy to do.
   
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.