PhysicsPESensor: OnProductsOverlap
When a product blocking a sensor causes there to be more than one blocking product, this event will be invoked. It is invoked when a product overlaps the sensor while one or more products are already blocking it.
Note: OnProductsOverlap does not support multiple subscriptions. Only the most recent subscription will be called.
Event
void xxxxxxxxxxxxxxxxx(sender: PhysicsPESensor, products: Product[]);
Parameters
Name | Type | Description |
---|---|---|
sender | PhysicsPESensor | The sensor that is being overlapped. |
product | Product[] | An array of the products currently blocking the sensor. This includes the product that triggered this event, along with any products that were already blocking the sensor. |
Example
function OnSimulationStart()
{
SubscribeAll("OnProductsOverlap", "Physics PE Sensor", OnProductsOverlap);
}
function OnProductsOverlap(sensor, products)
{
LogDebug(`${sensor.Name} is being blocked by ${products.length} products:`);
for (let i = 0; i < products.length; ++i) {
LogDebug(`Product ${i}: ${products[i].Name}.`);
}
}