Outline of clicked/selected object

You need to call updateSelection on the component (or modify the code to do it automatically)

but I can activate script with button

by user 869976161550217286

ok, will try

by user 869976161550217286

Is possible that this script dont work on objects with multimaterials? More than 1 element?

by user 869976161550217286

Could be - because multimaterial objects will be more than one object at runtime (three js turns them into multiple objects), a parent which is your original object and for each material one child object. Perhaps the effect is not smart enough the use the child meshes then

You can check in the code if the object is of type β€œGroup” and if so add the children


    updateSelection() {
        if (this._outlineEffect) {
            this._outlineEffect.selection.clear();
            for (const obj of this.selection) {
                if(obj.type === "Group") {
                  for(const ch of obj.children) this._outlineEffect.selection.add(ch);
                }
                else
                  this._outlineEffect.selection.add(obj);
            }
        }
    }

something like this should work

@miss3 did you figure it out? Does it work with non-multimaterial objects?

wait a sec, will test it now

by user 869976161550217286

I have added log stats on highlighted rock object with outline post effect, also at 3D scan statue on the rock. Same outline effect+volume

by user 869976161550217286

by user 869976161550217286

check console

by user 869976161550217286

name: β€˜3DScan_Man_019’ seems to be a Group

by user 869976161550217286

I have updated effect with the code provided, but it doesnt worrk

by user 869976161550217286

children objects of name: β€˜3DScan_Man_019’ are Mesh objects and MeshStandartMaterial is applied on them

by user 869976161550217286