ZoomAndFollowEquipment

When this function is called, the camera will zoom into and follow the specified equipment object. The ZoomAndFollowEquipment function ends when the StopZoomAndFollowEquipment function is called, or when the simulation is stopped.

Remarks: Available in Integrator only

Function

void ZoomAndFollowEquipment(equipment : object);
void ZoomAndFollowEquipment(equipment : object, viewName: string);
void ZoomAndFollowEquipment(equipment : object, viewName: string, zoom: integer);

void ZoomAndFollowEquipment(equipmentName : string, equipmentType : string);
void ZoomAndFollowEquipment(equipmentName : string, equipmentType : string, viewName: string);
void ZoomAndFollowEquipment(equipmentName : string, equipmentType : string, viewName: string, zoom: integer);

Parameters

Name Type Description
equipment Object The equipment object the camera will zoom to and follow.
equipmentName String The name of the equipment object the camera will zoom to and follow.
equipmentType String The type of the equipment object specified in the equipmentName parameter.
viewName String Optional: The name of the view in which to zoom and follow. If this value is missing, then all views will zoom and follow the specified equipment object.
zoom Number Optional: The distance to zoom out from the equipment object being followed, the default is 0.

Example

ZoomAndFollowEquipment("Conveyor1", "Conveyor"); 
ZoomAndFollowEquipment("Conveyor1", "Conveyor", "View1"); 
ZoomAndFollowEquipment("Conveyor1", "Conveyor", "View1" 5);

//Or

var conveyor = GetComponentByNameAndType("Conveyor1", "Conveyor");    
ZoomAndFollowEquipment(conveyor); 
ZoomAndFollowEquipment(conveyor, "View1"); 
ZoomAndFollowEquipment(conveyor, "View1" 5);

Sample Project

Troubleshooting

Issue: Camera does not follow a newly created product.

This is caused by timing. The CreateProduct() method asynchronously creates the 3d object and adds it to the scene. If you immediately attempt to follow a product after calling the ‘CreateProduct()’ function, Sym3 will not follow the product because the products 3d object has not added to the scene yet. To work around this, you will need to add a “SetTimerEx” callback function and follow the product only after it’s been added to the scene.

This code will not work as expected:

var newProduct = CreateProduct();
MoveProduct(newProduct, "Conveyor1", "Conveyor");
ZoomAndFollowProduct(newProduct); //This will not work as expected. Since the product has not been added to the scene yet. 

Solution:

var newProduct = CreateProduct();
MoveProduct(newProduct, "Conveyor1", 0);
SetTimerEx(1, 500, function () { ZoomAndFollowEquipment(newProduct, "Example"); }, null); //This will wait 500 milliseconds to allow Sym3 to add the new product to the scene.