Steering.core
Defines the basic reactive behavior of an Agent
[GET / SET] The preferred speed of the agent.
[GET] The maximum speed of the agent.
Calculates the "cost" of a given velocity which are used to decide which velocity an agent should actually
choose. There are multiple things this method needs to consider:
Target
Where does the agent want to move to?
Speed
How fast does the agent want to travel?
Time of impact
There are velocities which will lead to collisions with obstacles in the future
Side
It's often usful to prefer a "side" on which an agent avoids obstacles because it can help to reduce oscillations
Based on those the function should calculate the cost for a given velocity. To to this it should somehow combine different weighted scores.
The agent for which the cost should be evaluated
The velocity which should be evaluated
Normalized time of impact (between 0 and 1) for the velocity. A value of 0 means we are already colliding
and a value of 1 means that a collision will occure earliest at the .
The cost for the given velocity which should be between 0 and 1
An agent is the basic component you want to attach to computer-controlled characters.
It contains functionallity to avoid collisions with other agents/obstacles and tries
to get to some defined target-location. The avoidance is only local therefore it's
possible that the agent get stuck in local minima. For more complex navigation you
need a high-level pathfinding layer on top of the local avoidance.
[GET / SET] The Agents target velocity, i.e. the one which it tries to acquire.
This is a convenience property that automatically sets and
to the appropriate values.
[GET / SET] The Agents target velocity, i.e. the one which it tries to acquire.
This is a convenience property that automatically sets and
to the appropriate values.
[GET / SET] The target speed this Agent attempts to acquire unless distracted by other Agents.
[GET / SET] The radius of the agent (an agent is always representet as circle)
[GET / SET] The maximum time of impact wich the agent will react on.
If you set this too high your agent will oscillate alot in crowded situations and if you set
it too low your agent will avoid very late which looks artificial.
[GET] The calculated velocity which the agent calculated as optimum.
Implementation of which offers parameters
which are closely related to the algorithms used. Those might be hard to
configure if one doens't have background knownledge about the implementation.
In that case you should use .
[GET/SET] Factor between 0 and 1 which defines how much velocity-consistency should be weighted
[GET/SET] Factor between 0 and 1 which defines how much the difference from the optimal direction should be weighted
[GET/SET] Factor between 0 and 1 which defines how much the difference from the optimal speed should be weighted
[GET/SET] Factor between 0 and 1 which defines how much the time of impact with other obstacles should be weighted
[GET/SET] Value between 0 and infinity which defines the exponent applied to the TOI-penality. Can be used to
make the agent avoid other obstacles earlier/later.
[GET/SET] The speed which the agent should use if possible.
Implementation of which offers parameters
which are intuitve for end users. The purpose of this implementation is to
hide implementation details as much as possible. If you need more control you can
either use or use a custom implementation.
This Component assigns the objects RigidBody radius (taken from its first circle shape) directly to its
Agent radius, and applies the Agents suggested velocity back to the RigidBody. The sole purpose if this
Component is to visualize Agent behavior.
This static class contains constant string representations of certain resource names.
This interface should but doesn't need to be used by implementations of .
It defines which directions of velocities an agent preferes aka in which direction is the target of the agent
Evaluates the cost function for a given velocity direction.
The agent for which the cost should be evaluated
The direction for which the cost should be evaluated
This NOT the velocity but only the direction (vector is normalized) of it.
Cost for the given velocity which should be between 0 and 1
Creates velocity samples which are going to get tested with .
If the samples are poorly chosen or if there are simply not enough samples the agent won't be able to
choose "good" velocities which lead to a bad steering quality. If on the other hand to many samples are
generated the performance will suffer because for every sample the agent needs to calculate time of imapacts
with obstacles.
This method is called in every time step for every agent before the sampling starts.
If your implementation is adaptive you should throw away your old state here and start over.
Get the current sample velocity. The implementation is free to use internal information gathered from
previous calls to . You should make sure that your implementation
samples the zero-velocity.
Velocity which should be evaluated
Feeds the evaluated cost back into the sampler. The cost value can be used to adapt and intelligent choose the next
velocities.
The cost which was returned from
with the current velocity as parameter
true
if more velocities should be sampled and false
if
no new velocities should be sampled.
Simple brute force implementation of . Velocities are equally distributed in all directions
independent of the costs which are fed back.
Samples velocities based on the velocity the agent chose. The sampling
density is higher velocities close to the last best velocity.
This reduces samples needed massively compared to
but can potentially lead to undesired behavior.