Alice Community  

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

Reply
 
Thread Tools Display Modes
How do i do the collision detection code?
Old
xyflz
Guest
 
Status:
Posts: n/a
Default How do i do the collision detection code? - 11-01-2009, 05:55 PM

Hi im making an object runing behind another object. when i last object catch up the front object, i want him to turn and pass the front object. How can i make this possible? thanks a lot

ps: i tried the distance function with if and else statement but its not working. object is still going through another.

Last edited by xyflz; 11-01-2009 at 06:30 PM.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 11-01-2009, 06:38 PM

Odds are, the if/else if statment needs to be put into an infinity loop, then put into a do together method along with the method to make the character move. This way, the world will be constantly checking to see if the character is close enough to the object to collide with it.


(')>
   
Reply With Quote
Old
xyflz
Guest
 
Status:
Posts: n/a
Default 11-01-2009, 08:45 PM

i think i did that but i will check it again. thanks for tip
   
Reply With Quote
Old
xyflz
Guest
 
Status:
Posts: n/a
Default 11-01-2009, 08:47 PM

yea thats what i did but its still not working. can you check it for me please?
Attached Files
File Type: a2w project.a2w (2.20 MB, 18 views)

Last edited by xyflz; 11-01-2009 at 08:51 PM.
   
Reply With Quote
Old
xyflz
Guest
 
Status:
Posts: n/a
Default 11-01-2009, 08:55 PM

btw. when i use a method. how can i just remove the duration part without removing the whole method?
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 11-01-2009, 09:11 PM

You can't. If you change it, it'll stay there forever unless you delete it and re-insert it. It's one second by default, though, so if you want to change it to the default, change it to 1 second.

I'm taking a look at the world right now.


(')>
   
Reply With Quote
Old
xyflz
Guest
 
Status:
Posts: n/a
Default 11-01-2009, 09:14 PM

ok no wonder it wont let me do anything. yea when the chicken pass the turtle, chicken should run around the the turtle and talk. However,its not working at all.
your video on youtube is awesome i like it lol.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 11-01-2009, 09:21 PM

Nope, you put the collision detection method INSIDE the loop, not next to it in it's own loop inside the main do together method.

Put the if/else if statement in it's own, seperate loop, outside the chicken's motion method, and it'll work.


(')>
   
Reply With Quote
Old
xyflz
Guest
 
Status:
Posts: n/a
Default 11-01-2009, 09:28 PM

ok i see. im trying to make the them going around another when they pass the slower object. how do i make that work?
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 11-01-2009, 09:53 PM

The way the world is now, you can't. You'll have to change the movement methods to something like:

"While (animal) is at least .05 meters away from beach chair 1"
(animal) move forward .03 meters duration 0 seconds.

With the move to methods, each animal is locked on a linear path to each chair, unable to move to the side.


(')>
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.