A* Pathfinding Project  3.1.4
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Enumerations Properties Groups Pages
LightweightRVO Class Reference

Lightweight RVO Circle Example. More...

+ Inheritance diagram for LightweightRVO:
+ Collaboration diagram for LightweightRVO:

Public Types

enum  RVOExampleType { Circle, Line, Point, RandomStreams }
 

Public Member Functions

void CreateAgents (int num)
 Create a number of agents in circle and restart simulation.
 
void OnGUI ()
 
void Start ()
 
void Update ()
 

Public Attributes

int agentCount = 100
 Number of agents created at start.
 
float agentTimeHorizon = 10
 How far in the future too look for agents.
 
float exampleScale = 100
 How large is the area where agents are placed.
 
int maxNeighbours = 10
 Max number of neighbour agents to take into account.
 
float maxSpeed = 2
 Max speed for an agent.
 
float neighbourDist = 15
 Max distance for other agents to take them into account.
 
float obstacleTimeHorizon = 10
 How far in the future too look for obstacles.
 
float radius = 3
 Agent radius.
 
Vector3 renderingOffset = Vector3.up*0.1f
 Offset from the agent position the actual drawn postition.
 
RVOExampleType type = RVOExampleType.Circle
 

Private Member Functions

float uniformDistance (float radius)
 

Static Private Member Functions

static Color HSVToRGB (float h, float s, float v)
 Converts an HSV color to an RGB color, according to the algorithm described at http://en.wikipedia.org/wiki/HSL_and_HSV.
 

Private Attributes

List< IAgentagents
 All agents handled by this script.
 
List< Color > colors
 Color for each agent.
 
List< Vector3 > goals
 Goals for each agent.
 
Mesh mesh
 Mesh for rendering.
 
Color[] meshColors
 
Pathfinding.RVO.Simulator sim
 Reference to the simulator in the scene.
 
int[] tris
 
Vector2[] uv
 
Vector3[] verts
 

Detailed Description

Lightweight RVO Circle Example.

Lightweight script for simulating agents in a circle trying to reach their antipodal positions. This script, compared to using lots of RVOAgents shows the real power of the RVO simulator when little other overhead (e.g GameObjects) is present.

For example with this script, I can simulate 5000 agents at around 50 fps on my laptop (with desired simulation fps = 10 and interpolation, 2 threads) however when using prefabs, only instantiating the 5000 agents takes 10 seconds and it runs at around 5 fps.

This script will render the agents by generating a square for each agent combined into a single mesh with appropriate UV.

A few GUI buttons will be drawn by this script with which the user can change the number of agents.

Member Function Documentation

static Color HSVToRGB ( float  h,
float  s,
float  v 
)
staticprivate

Converts an HSV color to an RGB color, according to the algorithm described at http://en.wikipedia.org/wiki/HSL_and_HSV.

Parameters
h,s,vthe color to convert.
Returns
the RGB representation of the color.

+ Here is the caller graph for this function:

Member Data Documentation

float exampleScale = 100

How large is the area where agents are placed.

For e.g the circle example, it corresponds

Vector3 renderingOffset = Vector3.up*0.1f

Offset from the agent position the actual drawn postition.

Used to get rid of z-buffer issues


The documentation for this class was generated from the following file: