Click an object marked with a line?

Hi
In a blender, each click object is marked with a yellow line surrounding the model.
hgg
Is this option available in babylon.js, or any other option?
Any idea?
My babylon playgroud;
https://playground.babylonjs.com/#G2F8LN#20

Oh Aldin, are YOU back again? You sure are a work-aholic. :slight_smile:

Obviously, the best way to show that a mesh “is-selected”… is to squirt colorful particles from its vertices… https://www.babylonjs-playground.com/#2A4NUR#29

Ok, ok, that’s just a joke.

Here’s a link to search the old forum for ‘mesh is selected’. The 2nd return is the most interesting, where I list a few ways to indicate isSelected.

Inside my comment… does #3 in the list… look familiar? Remember our private project, with the pulsating emissiveColor? Fun, huh?

I am talking about showing when an object is selected, but that’s not your precise question, today. For what you seek, the outline-render might be the best. https://www.babylonjs-playground.com/#JY0TT#1

I think this uses the outlineRenderer, but a docs and playground search for 'outlineRenderer" or a docs search for ‘outline’… has weak returns. You’ll need to dig-deep to get more info (old forum search?).

Let’s see… umm… glows, highlights, perhaps outlines… COULD have depth-sorting anomalies (weirdness) because they might be post-processes… sort of a last-minute cellophane sheet with paint on it… placed across the mostly-rendered scene. Such things can act strangely when a highlight/glow is in-front-of SOME things, and behind other things (depth sorting).

If you remember our private project, we started with using highlightLayer, but ran into depth-sorting problems. Then we changed to pulsating emissiveColor. Anyway, have fun! I hope I have been helpful.

1 Like

This is great
Just like in a blender …
I remember the previous model marking example. This will leave for later tools. Outline color selected model is present in all 3d programs, so it looks more professional …
I succeeded by clicking on the model to put the green outline on the model, but clicking another model remains outline on the first clicked model?
Line 106;
https://playground.babylonjs.com/#G2F8LN#27
workaholic :grin:

Hi AA. Hey, the green outlines look GREAT, and no sign of depth-sorting problems. Perhaps outline feature is NOT a post-process “layer”… like glowLayer and highlighLayer are? We should research how it is done, someday.

If outline were a type of layer, it would probably be named outlineLayer, eh? :slight_smile: But it is not - good good good. I’m glad it is working nicely.

https://playground.babylonjs.com/#G2F8LN#31

I removed lines 104-106. Remember myMeshesOne/Two/Three are “arrays of meshes”… so renderOutline property is ignored… when set on an array-type object.

You would need to loop thru each array, and change eachmesh.renderOutline = false;
OR you could loop-thru scene.meshes, and change each-mesh THAT way.

Look at line 96. If there already WAS a selectedMesh, turn-off its outline. Works ok.

Remember that myMeshesOne/Two/Three… are arrays. They must be for-looped-thru… to access each mesh within.

You might wish to code some HELPER functions… such as:

var setPropertyOnEachItemOfArray = function(some_array_name, property_name, what_value)
{ code }

You know layerMasks, now, so you might make another helper…

var setPropertyOnEachItemOfLayer = function(some_layer, property_name, what_value)
{ code } This will be a bit more complicated… but a useful tool.

Looping tools - for doing things to each member of a group-of-mesh. Hunter-gatherer-tag-and-release helpers. :slight_smile:

Just some ideas for the future. :slight_smile: