// get camrea object
var cam = Scene.getCamera();
// create bus and set its rotation
var bus = Scene.createItem('LP_Bus', -10, 10, 0);
bus.addLocalRotation(0, 0, 0, 0, 0, 1, Math.PI / 2);
// set onCollisionEnter handler
bus.onCollisionEnter(function() {
// if bus collides with cam then move the cam back to the origin of the scene
cam.setPosition(0, 30, 1.5);
});
// update position of the bus (make it drive)
var xPos = -10;
Scene.scheduleRepeating(function() {
xPos += 0.1;
if(xPos > 10) {
xPos = -10;
}
bus.setPosition(xPos, 10, 0);
}, 0);