PDA

View Full Version : collision questions


pdibiaso
10-20-2005, 11:40 AM
i am trying to add a maze to my world. i want to set the walls so that whatever character is being used will not walk through. is there a way to set the walls to solid?

gabe
10-21-2005, 11:07 AM
There is no collision detection built into Alice. What you can do is use the proximity function "<object x> is at least <y meters> from <object z>".

For example, if you want the chicken to move towards the penuin ntil it is right in front of it without touching, you can do something like:

pdibiaso
11-01-2005, 05:47 PM
you responded to my previous post. however, i want to use the arrow keys to move my character arround and when i use that code this does not work...i can still move the character forward (or which ever direction i am trying to go)

gabe
11-01-2005, 10:03 PM
I have merged your two threads together so as to make is easier when people are searching for information regarding collision detection.

you responded to my previous post. however, i want to use the arrow keys to move my character arround and when i use that code this does not work...i can still move the character forward (or which ever direction i am trying to go)

Correct -- using the arrow keys to move a character will do nothing to prevent that character from going though other objects. You can try running an infinite loop where Alice first looks to see if one object is within x meters of another object, and then if it is, move it back (set duration to 0 seconds so it will be instant). This will sort of get around the problem, but might cause more problems.

Getting objects not to go through one another is a difficult thing to achieve, and there are certain "hacks" that you can do to try and mask the lack of collision detection. For example, in the Flight Simulator example world, the helicopter can go through the ground, but immediately there will be a crashing sound and lights flashing, to mask the helicopter intersect with the ground. Then, the helicopter moves back to the sky.

Another trick is to use a first-person perspective (i.e., use the camera as the character). Through this means, you can't go through another object. (Well, you can, but you have to move backwards.)

Keep at it!