Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Collision Detection - one vehicle, multiple buildings
Old
fortunado
Guest
 
Status:
Posts: n/a
Unhappy Collision Detection - one vehicle, multiple buildings - 04-27-2010, 11:13 AM

I'm finishing up an assignment that I need to turn in tomorrow and I decided to implement collision detection if I can. I noticed someone just recently posted a similar request so I am going to look at those worlds posted but wondered if I could get some pointers on my particular problem.

I created a small maze of buildings and am going to have a blimp fly through them to reach a stadium at the end. It's very simple.

My professor showed us how to make collision detection between two objects using an IF distance from A to B is <= combined width / 2 then move backward. I found the only way I could use that was to bind a move forward method to my blimp and then an IF ELSE for each individual building.

Obviously this makes it run like crap and the movement is not fluid at all. I'd really like to get the blimp to move more fluidly; the arrow keys are ok but not great. At least they beat my custom arrow implementation.

I'm mainly looking for help with the building/blimp collisions. Thanks!
Attached Files
File Type: a2w AFR_Project.a2w (9.95 MB, 12 views)

Last edited by fortunado; 04-27-2010 at 03:45 PM.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 04-27-2010, 04:54 PM

Ok I think I fixed yours. The problem was that your world was detection collisions only when going backwards. I just changed the "distance in front of all walls" and behind one to >=. I think it is because the blimp itself has a backwards orientation, but I don't know for sure because I didn't look much into it. It should work now, and I added a few more walls because you had some gaps. Also, you can still go through some building sometimes if you go at just the right angle, so you might want to fool around with that.

It's not perfect, but I did fix what you wanted me to.
Attached Files
File Type: a2w AFR_Project.a2w (9.95 MB, 16 views)


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
fortunado
Guest
 
Status:
Posts: n/a
Thumbs up 04-27-2010, 05:07 PM

Ah, now that would make sense. I just assumed that the front of the blimp would be the front of the blimp object. Thanks for the help, I really appreciate it.
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 04-27-2010, 05:09 PM

Oh yeah, I forgot to tell you that when you go backwards, there will be no collision detection. You can try to find out how to get that to work, or just take out the option to go backwards, up to you. Or you can just leave it in as a failsafe in case you accidentally do go through a building when you weren't supposed to (but you shouldn't use it to cheat ).


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
fortunado
Guest
 
Status:
Posts: n/a
Default 04-27-2010, 05:19 PM

That too makes sense. What I saw happening was that I could clip right through a wall, but when I backed up, the wall would properly bounce the blimp off of it. Maybe I should have used a helicopter? ;P
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 976
Join Date: Sep 2009
Location: United States
Default 04-27-2010, 05:32 PM

Well it doesn't matter what the object is, a helicopter might have the same problem, plus you would have to worry about helicopter motions and stuff like that. Just try to logically figure out the problem, think to yourself why is it only working these times, and try to fix it from there by changing some things, and every time it doesn't work just undo it and try again.


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
fortunado
Guest
 
Status:
Posts: n/a
Default 04-27-2010, 06:28 PM

Quote:
Originally Posted by Dameria View Post
Well it doesn't matter what the object is, a helicopter might have the same problem, plus you would have to worry about helicopter motions and stuff like that. Just try to logically figure out the problem, think to yourself why is it only working these times, and try to fix it from there by changing some things, and every time it doesn't work just undo it and try again.
Thanks for the help; I appreciate the logic insight as well. One thing I did do was raise up all my walls a bit so I could see their front directional lines (the blue lines). This helped me get everything situated facing the right direction.
   
Reply With Quote
Reply

Thread Tools
Display Modes

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.