Polarith AI

front-end / back-end: AIMAvoid | Avoid
inherits from: AIMRadiusSteeringBehaviour | RadiusSteeringBehaviour

This behaviour is used to actively avoid obstacles. The direction towards the obstacle is applied as the normal of a plane which is then used for sensitivity mapping (writing objective values). Sensitivity mapping against a plane results in strongest magnitudes for receptors which are on the plane and lowest magnitudes for receptors which are perpendicular towards the plane. Thus, the ideal avoid direction is always perpendicular to the obstacle direction. In contrast to PlanarAvoid, this behaviour is feasible for arbitrary scenarios (with any kind of 3D sensor).


This component has got the following specific properties.

Property Description
PlaneBend An angular offset in degrees and within the range of [0,90]. The offset is applied to the plane such that the optimal direction is shifted towards the obstacle direction. This parameter defines the angle used for avoiding the obstacle (see Figure 1).
UseVelocity If enabled, the current velocity of the agent is used to emphasize the avoid direction which corresponds to the velocity. Note that the velocity needs to be tracked, which is done automatically if either a SteeringTag or a rigidbody is attached to the agent's game object.
DefaultOrientation Can be used instead of the agents velocity. This direction defines the agent's default alignment. The two most common cases are (0, 1, 0) for 2D games and (0, 0, 1) for 3D games.



Sensitivity mapping against a plane always leads to a symmetrical magnitude distribution in the context map. An example can be seen in Figure 1. Of course, it makes sense that the agent perceives every possible avoid direction. However, this may lead to problems with certain agent configurations. For example, the agent might jitter back and forward because it suddenly decides to use the opposite direction which might happen due to numerical inaccuracies. There are some ways to tackle this problem:

  • Enable UseVelocity,
  • apply the Stabilization behaviour, or
  • provide additional information by utilizing a danger objective, e.g. through a Seek behaviour.

Another important aspect is that the plane gizmo considers only the last updated percept. Hence, it can only be used to visualize the effect of one perceived object at once.

Figure 1: Shows the effect of PlaneBend. At the left, it is 0° and at the right, it is set to 45°. Due to the nature of plane-based sensitivity mapping, the result is a symmetrical context map. This can be avoided by enabling UseVelocity.