Пример #1
0
        public static Vector3 CalculateNextVelocity(AgentState agent, AgentEnvironmentModel model)
        {
            Vector3 drivingForce             = DrivingForce(agent);
            Vector3 interactionForce         = InteractionForce(agent, model.Neighbours);
            Vector3 obstacleInteractionForce = ObstacleInteractionForce(agent, model.Walls);

            interactionForce.y         = 0; //Assumes all agents are vertically oriented
            obstacleInteractionForce.y = 0; //Assumes all walls are vertical oriented (perhaps a less fair assumption than the latter)

            return(drivingForce +
                   interactionForce +
                   obstacleInteractionForce);
        }
Пример #2
0
        //TODO benchmark in reference parameters


        public static Vector3 CalculateNextVelocity(AgentState agent, AgentEnvironmentModel model)
        {
            Vector3 drivingForce             = DrivingForce(agent);
            Vector3 interactionForce         = InteractionForce(agent, model.Neighbours);
            Vector3 obstacleInteractionForce = ObstacleInteractionForce(agent, model.Walls);

            interactionForce.y         = 0; //Assumes all agents are vertically oriented
            obstacleInteractionForce.y = 0; //Assumes all walls are vertical oriented (perhaps a less fair assumption than the latter)

#if UnityEngine
            Debug.DrawLine(agent.position, agent.position + drivingForce, Color.red);
            Debug.DrawLine(agent.position, agent.position + interactionForce, Color.cyan);
            Debug.DrawLine(agent.position, agent.position + obstacleInteractionForce, Color.yellow);
#endif

            return(drivingForce +
                   interactionForce +
                   obstacleInteractionForce);
        }
 public Vector3 NextVelocity(AgentState state, AgentEnvironmentModel model)
 {
     return(nextVelocity.Invoke(state, model));
 }
Пример #4
0
 public override void Initialise(int id, ILocalAvoidance localAvoidance, AgentEnvironmentModel initialEnvironmentModel)
 {
     AgentState tmp = ConstructState(id, default, default, default, default);