About Capacities

Capacities are actions triggered by events. Capacities show what a behavior or an actor can do in an experience.

They are useful when you work with scenarios. There are three types of capacities: events, functions, and services.

Sensors can be events or functions. Drivers can be functions or services.

This page discusses:

Event Capacity

An event capacity is executed after an event happens.

Examples of event capacities

  • Is Clicked
  • Detects The Entry Of

Function Capacity

A function capacity enables to modify the state of an object or check actor's properties.

Examples of function capacities

  • Is Visible (sensor state)
  • Is Active (sensor state)
  • Hides (driver state)
  • Shows (driver state)

Service Capacity

A service capacity enables to modify actor's properties over time.

Examples of service capacities

  • Goes To
  • Follows
  • Looks At

The service capacity has a specific lifecycle. It is a capacity with a beginning and an end.

During its execution, you can control what is done and under which conditions the capacity ends.

Service Capacity Workflow



In the image above, there are four functions (Start, Execute, End, and Stop) that you need to implement in JavaScript to create a service capacity.

OptionDescription
Start First function executed when the service starts
ExecuteFunction called for each frame while the service capacity is running.
EndFunction called to know if the service capacity has ended or not.
StopLast function called when the service capacity ends.
FalseIf False, the service capacity starts again.
TrueIf True, the service capacity ends.

Example

In the following example, a service capacity is created to let a human actor walk to a specific target.

The four functions to implement are the following:

  • Start: the human starts walking.
  • Execute: the human moves to target from 5mm.
  • End: function that checks if the human has reached the target.
  • Stop: the human stops walking.