Skip to content

Custom Events

Custom Events are the primary way Cognitive3D collects non-gaze telemetry data (events from participant) from your experience.

Custom Events automatically record x,y,z coordinates. If the position is not provided, it will use the position of the HMD. This allows us to map every single Custom Event to a specific point in your immersive experience. In conjunction with visual telemetry (gaze tracking), coordinates gives you the ability to map out how your participants are interacting with your experience in 3D space.


Custom Events

Custom Events are sent with a line of code:

new CognitiveVR.CustomEvent("Picked up shopping basket").Send();

You can add a custom position to your custom event:

var basketPosition = shoppingBasket.transform.position;
new CognitiveVR.CustomEvent("Picked up shopping basket").Send(basketPosition);

You can also add properties to your Events:

var productPosition = someProduct.transform.position;

//you can either write properties one at a time
new CognitiveVR.CustomEvent("Picked up shopping basket")
    .SetProperty("Basket Location", "Store Entrance").Send(productPosition);

//or several at once with a dictionary
new CognitiveVR.CustomEvent("Picked up shopping basket")
      .SetProperties(new Dictionary<string, object> {
        { "Basket Location", "Store Entrance" },
        { "Some Other Property", 100 }
      })
      .Send(productPosition);

Events are visible on the Dashboard on the Session Details page and Analysis Tool. They are also a common feature of the Objectives system.

Event Duration

If an event represents an interval of time, rather than something immediate, you can automatically record a 'duration' property. This is likely the intended result of creating a Custom Event in 'Update'. That method will result in thousands of data points without clearly displaying that time interval.

Simply delare a Custom Event variable when the event starts and call Send when the event ends:

// Item.cs
using CognitiveVR;

private CustomEvent holdEvent;

public void PickupItem()
{
  // Some code to pickup the item
  // ...
  holdEvent = new CustomEvent("Product Grabbed");
}

public void DropItem()
{
  // Some code to drop the item
  // ...
  if (holdEvent != null)
  {
    holdEvent.Send(transform.position);
    holdEvent = null;
  }
}

Object Events (Basic)

ObjectEventTable

You can also tag objects in your Custom Events to begin mapping different metrics to your Dynamic Objects. This work very well for things like object purchases, or any custom types of interactions you may have with an object.

Just append the SetDynamicObject(DynamicObjectId) method to your new CustomEvent:

// ShoppingCart.cs
using CognitiveVR;

public void PurchaseItem(GameObject product) {

  // Some code to purchase an item
  // ...

  var pos = product.transform.position;
  var id = product.GetComponent<DynamicObject>().GetId();
  new CustomEvent("Product Purchased").SetDynamicObject(id).Send(pos);
}

This will enable sorting objects by their Events on the Object List page:

Dropdown Results

Object Events (Advanced)

You can also add properties to your object events. This is useful for custom sensors, or any additional data you have on your objects.

Just append the SetProperty("propertyName", propertyValue) method to your new CustomEvent:

// ShoppingCart.cs
using CognitiveVR;

public void PurchaseItem(GameObject product) {

  // Some code to purchase an item
  // ...

  var pos = product.transform.position;
  var id = product.GetComponent<DynamicObject>().Id;
  new CustomEvent("Product Purchased").SetDynamicObject(id).SetProperty("Product Price", 2.99f).Send(pos);
}

This will open up an additional sorting option on the Object List, giving you the average value over this property:

Results

Event Sensors

When recording your Custom Events, you can append the current state of every sensor at that moment. This will be recorded as properties and will be visible in the Event Query Tool on our Dashboard.

public void PurchaseItem(GameObject product) {
  var pos = product.transform.position;

  //this will append the latest value of every sensor
  new CustomEvent("Product Purchased").AppendSensors().Send(pos);

  var id = product.GetComponent<DynamicObject>().Id;  
  //this will append the latest value of only the heartrate sensor. this can also be used with 'SetDynamicObject'
  new CustomEvent("Product Purchased").AppendSensors("heartrate").SetDynamicObject(id).Send(pos);
}

Advanced Uses Cases

Trigger Areas

You can use Custom Events to identify when a Participant enters and exits a pre-defined region in your scene. Recording when a participant enters an area could be useful to build Objectives with positional data normally only available in SceneExplorer.

At a high level, you could create a Custom Event when the participant enters the area and call 'Send()' on that Custom Event when they leave. The area would likely be defined using a collider with 'IsTrigger' enabled. The player GameObject would also need to have a collider and a kinematic rigidbody to activate the trigger when they enter.

Sample Script