Proximity detection?

I’m basically trying to make it so that when an object called “Predator” is a certain distance from an object called “Prey,” the object “Prey” runs away. How do I detect proximity with Logic Bricks?

You’re looking for the “Near” sensor.

Ok. How exactly does that work? I’m a total beginner at this.

I see a thing that says “only look for objects with this property,” what would be the property for named “Predator”?

You can do that a few different ways. I did something similar. on your predator object add a int property, call it anything you like then on your prey add a sensor you can use property, radar, ray. I use a radar. make sure that you are using the correct axis and distance, in the prop section write the property name down. When your prey gets close it will detect predator then do what you want like turn or turn and run,etc Fool around with different sensors to see what works best for your needs.
If you still can’t do it post a blend of what you have so far


On your prey object, add the near sensor. change it’s distance value to whatever distance you want it to run away. Connect your near sensor to a controller, and then to whatever actuator you used to make it run away.

What do I put in the box for Property so it only runs from Predator?

make a property on the predator, call it “enemy” or something.
Then type that same name in the near sensor

Like i said call it anything you like, you can call it “predator” for example then whatever sensor you use for your prey object, radar for example in the prop box write “predator” When prey gets close to predator, that has the “predator” property it will do what you want , like run away. If you still have trouble post your blend, but i think you will be able to do it now. I use the radar but radar can see through other objects so if there is a wall separating the predator and prey, your prey will still run so another sensor will be better depending on your scenario you might want to read the gamekit book or some tutorials