Social forces are calculated directional forces that are applied to agents who have a social force behavior active. These forces make up the individual components that, when added together, effect a cumulative force that accelerates the agent in a certain direction.
The user interface for forces will often display an equation that represents how the force is being calculated. You can get hints as to what each of the components of the equation means by clicking on the equation.
Equations are usually composed of a user-defined scale factor, which is multiplied by some directional unit vector. Then the result is subsequently multiplied by a factor that is dependent on the distance from the agent. You enter an exponent value to define how the distance from the neighbor agent affects the overall force calculation.
Let's take for example an attractive force, which attracts an agent towards its neighbors.
The symbol ûₙ represents the normalized (unit) vector directed at the neighbor, i.e. from the agent's center to the nearest point on the neighbor's bounding box. This unit vector is scaled by a scale factor that you can define. Then the result is again scaled by a factor that is dependent on the distance from the agent, represented by the symbol ‖uₙ‖.
As an example, let's say that ûₙ is the vector [0.97, 0.24], and that ‖uₙ‖ is 0.5, which is a rough estimate of the picture shown above. You have defined a scale factor of 0.1 and a distance exponent of -1. First the equation scales ûₙ by 0.1, resulting in the vector [0.097, 0.024], then it multiplies that vector by 0.5^{-1}, or 2. Thus the resulting force, for that neighbor, is [0.194, 0.048].
f_{n} = 0.1 · [0.97, 0.24] · 0.5^{-1} = [0.194, 0.048]
In this scenario, if no other forces are affecting the agent, then the agent will take on a directional acceleration of [0.194, 0.048].
Note the effects of the two user-defined values in the equation. The scale factor — in this case 0.1 — serves to generally scale the force. You use this scale factor to adjust the strength of the force in relation to other forces that make up the social force behavior. The exponent value — in this case -1 — scales the force dependent on the distance from the agent. A value of -1 means that, as the distance gets larger, the force gets smaller, and as the distance gets smaller, the force gets larger. For an exponent value of -2, the inverse relationship between distance and force is even stronger, and would be synonymous with a gravity-like force. You could also give the exponent a value of 0, which means that distance has no effect on the force's magnitude. Alternately, if you give the exponent a positive value, then there will be a positive correlation between distance and force magnitude. As distance gets bigger, the force gets bigger.
A neighbor-based force, such as an attractive force, will sum all of the forces calculated for each of an agent's near neighbors. This summation is represented in the display of the equation with the Σ symbol.
The neighbor-based forces are the following:
As described above, the attractive force is a force that attracts an agent to its near neighbors. It calculates the force for each neighbor that is within the maximum distance, and then sums the individual forces together.
In addition to the scale value and exponent, the attractive force has the following properties:
A repulsive force is similar to an attractive force but applied in the opposite direction, namely away from neighbor agents. In addition to standard attractive force properties, it has the following:
The cohesive force attracts the agent to the 'center of mass' of its neighbor agents. The cohesive is an attractive force where the Per Neighbor Magnitude is unchecked.
A transverse force is applied when neighbors of the agent are traveling toward the agent. This force will push the agent to move to the right. The first field is the scale factor, its value will determine the direction: a positive value will cause the agent to move to the right, a negative value will cause the agent to move to the left. The second value is the exponent value.
An alignment force is a force that motivates the agent to align its velocity with the velocity of its neighbors. For this force, the vector Δvₙ is calculated as the difference between the neighbor's velocity and the agent's velocity. In other words it is the force which, if applied to the agent, will change the agent's velocity to be the same as the neighbor's velocity.
These are the following Self-based forces:
A friction force is applied in the opposite direction of an agent's travel.
A momentum force is the opposite of a friction force. It will push an agent to continue along its travel path. The first field is the scale factor, the second field is the exponent.
A goal-based force will motivate the agent to move toward a goal. There are two possible forces here: a travel destination force, and an A* travel path force. If you define a goal-based force, you should choose one of these but not both.
A travel destination force will take any travel tasks the agent is given and use the final destination location as a pulling force upon the agent, causing the agent to move towards its goal. As with other forces the first field is the scale factor, and there is an exponent field as well.
The A* travel path force will use elements from A* navigation to calculate forces. The agent system will communicate with the A* system to determine a path. Once the path is calculated, the agent will be motivated, through this force, to move along the path to its destination. As an agent moves along its path, it will have a current target node that acts as its current anchor to the path. The agent's path attraction is made of two primary forces associated with its current target node. The Node Attract Force attracts the agent directly to the node, whereas the Path Align Force motivates the agent to travel in the direction that the path is headed at the current target node.
A Custom Force allows a force to be defined through custom code.
This will apply a force compelling the Agent toward a random direction based on the defined magnitude.