How to detect and remove huge or "poison" builds or prevent them to be built


#1

Handling a tutorial area where newbies can build while I am teaching them how to use create and editing tools, it happens quite often that apparently someone creates very wrong boxes or models, possibly too big and pushing all the avatars to empty zones in the domain, so it seems like the domain is completely dark and unconnected.

Apparently avatars are pushed on coordinates like 0,-1000000000000000000000000000000000000,0 so in the nowhere …

Since this is happening quite often I’m wondering if there is something helping me in finding the “poison” object so to be able to remove it and put back the domain in operation.

Or otherwise if there is a way to make all the objects phantom so that possibly we can investigate the domain and try to find it. Maybe an option to find too big objects, or clamping max size that an object can be for my domain?

PS: My students got quite scared when they are put in the digital virtual hell …


#2

Try to use the search function in create. You possible need to increase the search range. then you see all objects. Hope you can find the wrong one then.


#3

this is how I did, but it is really a mess. :frowning:
need something more effective…


#4

Hi Claudio,

You could consider adding a filter to the domain that would prevent this from happening - what that would do is enable you to limit the size of items or remove the ability to collide with avatars when they’re created. The documentation on filters isn’t extensive (https://docs.highfidelity.com/create-and-explore/start-working-in-your-sandbox/creating-and-securing-your-domain#filters) but there are some examples in the feature PR here (https://github.com/highfidelity/hifi/pull/11997) about how they work and some sample ones.

A filter basically is a custom JS function that runs between the time you add or edit an entity and the time it’s added to the server. So the domain owner can have a custom filter that adjusts or rejects the properties entirely. Note that if you have lock/unlock permissions, you bypass the filters, so I’d recommend removing that permission for students creating until they get the hang of it, in which case they can still add/remove things from the world but with a little more guidance.


#5

Thanks for the hint. However I tried to setup the following script and set up in the filter property of a zone, but apparently it did not worked, and had any clue in understanding how I can debug it. Sorry for being a newbie in scripting in js highfidelity. The script is available at https://edu3d.ovh/sal/scripts/filter.js
i tried to change the dimensions of a box to 50 x 50 x 50 and it let me do that.
The script was inspired by one of the scripts you suggested in the page with the samples you can probably find it easily.
The trivial question is if this script has been correctly written … Or can be written in a simpler way…

function filter(properties, type, originalProperties, zoneProperties) {

var nearZero = 0.0001 * Math.random() + 0.001;

/* Clamp position changes to bounding box of zone.*/
function clamp(val) {
    var min= 0.5;
    var max= 10;
    /* Random near-zero value used as "zero" to prevent two sequential updates from being
    exactly the same (which would cause them to be ignored) */
    if (val > max) {
        val = max - nearZero;
    } else if (val < min) {
        val = min + nearZero;
    }
    return val;
}

if (properties.dimensions) {
    properties.dimensions.x = clamp(properties.dimensions.x);
    properties.dimensions.y = clamp(properties.dimensions.y);
    properties.dimensions.z = clamp(properties.dimensions.z);
}
console.log( JSON.stringify(properties) );

return properties;

}

filter.wantsOriginalProperties = true;
filter.wantsZoneProperties = true;
filter;