function filter(p) { /* Define an axis-aligned zone in which entities are not allowed to enter. */ /* This example zone corresponds to an area to the right of the spawnpoint in your Sandbox. It's an area near the big rock to the right. If an entity enters the zone, it'll move behind the rock.*/ if (p.position) { /* Define the points that create the "NO ENTITIES ALLOWED" box */ var boxMin = {x: 25.5, y: -0.48, z: -9.9}; var boxMax = {x: 31.1, y: 4, z: -3.79}; /* Define the point that you want entites that enter the box to appear */ var resetPoint = {x: 29.5, y: 0.37, z: -2}; var x = p.position.x; var y = p.position.y; var z = p.position.z; if ((x > boxMin.x && x < boxMax.x) && (y > boxMin.y && y < boxMax.y) && (z > boxMin.z && z < boxMax.z)) { p.position = resetPoint; if (p.velocity) { p.velocity = {x: 0, y: 0, z: 0}; } if (p.acceleration) { p.acceleration = {x: 0, y: 0, z: 0}; } } } return p; }