Alice Community  

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

Reply
 
Thread Tools Display Modes
make collision with objects in alice
Old
whidragon
Guest
 
Status:
Posts: n/a
Default make collision with objects in alice - 11-18-2008, 02:01 PM

how would i make an object like a car collide with the buildings and other objects and not go through them.

also if i could get help with programing the goal line that be apreciated

ill upload my world to make it easyer to understand what im trying to do
   
Reply With Quote
No Collision
Old
dragon_drone13576
Guest
 
Status:
Posts: n/a
Default No Collision - 11-18-2008, 09:01 PM

I'm not sure how you could make a goal line, but the object collisions aren't so hard.

You need to create an event that checks the distance from the object that you want to move (like a car) and the object that it might collide with (like a building). An example would be something like this:

While car is at least (width of building / 2) away from building:
Begin: Do nothing
During: Do nothing
End: Car move backwards [insert number here] meters

What happens is that when the car is not touching the building, it will do nothing. When the car reaches the outside wall of the building (the width divided by 2 is to find the radius), it will move backwards. This would act as a bounce back from the collision. Whatever number you choose for the meters should be eqaul to how fast the car travels in one second, that way even if you keep trying to move forward you won't go anywhere.

There are two problems that immediately come to mind with this, however. First, it might take forever to figure out the number of meters that the car would need to move backwards. Second, this code only would work for one building. You would need to make one of these for each one of your buildings.

I haven't tried this out myself yet, so you should test it with the first building before you go and write all of your code. Good luck!

P.S.- One way that you might be able to check for a certain point crossed is to put a large invisible circle across the finish line, that way you could check for something to hit that point to win or whatever. If you just have something that says 'You Win', you could easily just make that become visible when the car hits that spot. Just make the sign start on the screen and vehicle it to the camera.
   
Reply With Quote
the file
Old
whidragon
Guest
 
Status:
Posts: n/a
Default the file - 11-20-2008, 11:33 AM

i have uploaded the file i am working on i tryed your sugestion and couldent get it to work maybe you or another member would have better luck please help if any one is able to program any part of it collison with a specific peice i could do the other peices. i have left comments in teh code as to what ide liek to happen
Attached Files
File Type: a2w ice car.a2w (1.80 MB, 59 views)
   
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 ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.