Reacting to object proximity

Using the event node, it is possible to perform actions when two object nodes come close to each other. The example below demonstrates this.


	<object id="ball" type="ball.aro"/>
	<object type="bat.aro" relativeto="camera">
		<event type="onproximity" to="ball" threshold="0.1">
			<transition object="ball" what="position" end="3 0 0" length="1000"/>

The proximity calculation is from the centers of the two objects - the 3D models are not taken into consideration. The threshold property is provided to allow you to choose the distance between the centers that triggers the event. In the example above a good choice might be the radius of the ball.

The event will not be triggered if either of the objects have their visible parameter set to false.