Near sensor: can't make it work

Hi, i’m trying to start an event with a near sensor pulse, i have an object A which will do something when is near object B.
To do that i defined a Property in object B, an Integer Property and in object A a Near Sensor with the name of this property in the field Property and a Python controller to check if the near sensor isPositive() and do something if it is.
The problem is that the Near sensor never is positive, no matter the value i put in the Dist and Reset field, i think that something’s missing…
Maybe i need a Property Actuator or something to check the property

When a near sensor doesn’t work, use Ray sensors. A Ray sensor detects something in the axis where it’s set too. like:

  • ray sensor: detect +y axis, range: 3.0, property: object
  • when a mesh with a property: object is been detected on axis +y, and inside the range of 3.0 or less, it activates the ray sensor.

Really handy for AI, when a AI enemy is using the above ray sensor included with it’s options, the AI can do something then like turning 90 Degrees. That will avoid hitting the wall or something else :stuck_out_tongue:

The near sensor seams to have some problems sometimes. No idea if that is fixed. But I’m working on a python game project, when I encounter any bug, I’ll make directly a bug report blend included how to reproduce and report it. I hope more people do that. :smiley:

No idea if that is fixed.

Actually, I wasn’t having any problem with it until this latest release. Now it works fine as far as triggering, but the reset is weird. It’s resetting at the start of a new script instead of the distance measurement. It’s definately different because the program I was working on was fine until this version.

If i remember right, the Object to react on, must have a collision Face, and must be an Actor. Near Sensors does not work with Emptys and other non Mesh Objects.
hope that helps.
Doc

:stuck_out_tongue: i’m using the Ray sensor and it works fine :stuck_out_tongue: :stuck_out_tongue: