Marker Component

The marker component can be used to markup objects and locations with gameplay relevant semantical information.

To implement game mechanics, especially some form of AI, your code must be able to reason about objects in the game. An AI for an NPC must be able to scan its nearby environment to detect objects that it can interact with, other NPCs, the player and locations that may be of interest.

The spatial system is there to provide efficient means to do such queries. Using spatial queries, you can find all objects within an area that belong to some group. For this to work, you obviously need to insert objects into the spatial system. The marker component is a simple and convenient way to do so.

All that the marker component does, is to insert a sphere of a given size and category into the spatial system, so that the object that the component is attached to, can be found with spatial queries.

Note:

Keep in mind that the number of categories available for use is limited to about 25. You should therefore prefer generic categories where possible.

Properties

Marker: Which spatial data category to use for this marker.

Radius: The size of the marker.

Examples

The marker component can be used for many purposes. Here are a couple of examples:

For an example how marker components and spatial queries can be used to find nearby objects, have a look at the Sample Game Plugin.

See Also