Game Development Reference
In-Depth Information
RAIN sensor filters
If you tried running the demo with multiple gold pieces, you must have seen a small
problem. The ship always goes to the first piece of gold it sees, but that might not be
the closest. If it sees a distant piece from the corner of its eye, it will go straight to
it even if there are ones closer to it. A quick fix for this is to add a filter to the RAIN
sensors. Filters are ways to manipulate the list of sensed objects, and RAIN might
have more in the future but for now, it just has one: NearestXFilter . Select Visual
Sensor in the ship and set the Size field to 1 and select NearestXFilter under the
Filters section. The following screenshot will show the settings of NearestXFilter on
the sensor:
The NearestXFilter filter will send a given number of closest objects to the sensor.
In our case, we just leave it to one. If you run the demo now, the ship will always pick
up the gold that it can see and that is the closest to it first. This completes our ship
demo.
Search WWH ::




Custom Search