Agent

Description

Provides access to data and methods related to Agents who are members of an Agent System.

Properties

object Gets the object associated with the agent.
socialForce Accesses the social force state of the agent.

Methods

activateBehavior Activates a named behavior of an agent.
deactivateBehavior Deactivates a named behavior of an agent.
neighbors Retrieves the set of in-proximity neighbors associated with a behavior.

Constructor

Agent Gets access to the Agent associated with an Object.

Details

Do no remove, this fixes the anchor on doc.flexsim.com

Agent.object

Object object

Description

Gets the object associated with the agent.

Do no remove, this fixes the anchor on doc.flexsim.com

Agent.socialForce

Agent.SocialForceState socialForce

Description

Accesses the social force state of the agent.

If the agent does not have a social force behavior activated, this property will be null.

Do no remove, this fixes the anchor on doc.flexsim.com

Agent.activateBehavior()

activateBehavior( string name )

Parameters

name The name of the behavior you want to activate

Description

Activates a named behavior of an agent.

agent.activateBehavior("ProsimityBehavior");
Do no remove, this fixes the anchor on doc.flexsim.com

Agent.deactivateBehavior()

deactivateBehavior( string name )

Parameters

name The name of the behavior you want to deactivate

Description

Deactivates a named behavior of an agent.

agent.deactivateBehavior("ProsimityBehavior");
Do no remove, this fixes the anchor on doc.flexsim.com

Agent.neighbors()

neighbors( string behaviorID = nullvar )

Parameters

behaviorID Usually this is the name of the behavior you want to deactivate. If you do not pass this behavior in, then it will use the first activated proximity behavior it finds. If you have a reference to the behavior node, you can pass this as well, and it will return the neighbors for that behavior.

Description

Retrieves the set of in-proximity neighbors associated with a behavior.

var neighbors = agent.neighbors("ProsimityBehavior1");
Do no remove, this fixes the anchor on doc.flexsim.com

Agent Constructor

Agent( Object object )

Parameters

object An object that is a member of an agent system.

Returns

Agent An AGV object

Description

Gets access to the Agent associated with an Object.

To access the Agent associated with an object, you must either use this constructor, or call Agent.System.getAgent. If an object is a member of multiple agent systems, then calling this constructor will access the first system the object is a member of. Casting from a treenode is not correct.

You should use this constructor instead of the as() casting method. Using as() on an object will not work properly.

Agent agent = Agent(object); // correct
Agent agent = object; // auto-downcast: incorrect
Agent agent = object.as(Agent); // explicit cast: incorrect