PESensor: OnProductsDetected

Invoked when the sensor detects products. This event is still fired for each product when products are accumulated and “Touching Products Do Not Unblock Sensors” is enabled.

Note: This event does not support multiple subscription. Previous subscription will be lost if subscribe twice.

Event

void xxxxxxxxxxxxxxxxx (sender: object, product: Product);

Parameters

Name Type Description
sender Object The sensor which detected the product
product Product The product item which is detected by PE sensor

Example

function OnSimulationStart() {
    LogDebug("OnSimulationStart called");
    SubscribeToEvent("OnProductDetected", "PESensor1", "PE Sensor", handleproduct);
}

function handleproduct(sender, product) {
    LogDebug("handleproduct:");
    MoveProduct(product, "Conveyor2", 0.3);
}