#Hiding a group also hide other objects?

30 messages · Page 1 of 1 (latest)

frozen token
#

Hello everyone,

So I think this is a pretty basic question but I can't figure it out.

I have a scene with 3 root objects in it :

  • what I call a background (a big white square)
  • what I call a pixel (a red small square)
  • and a group that contains a bunch of lines to draw a grid

You can see a screen of those root children and if you check the console, you will see that those 3 items are properly placed at the root of my scene.

When I switch the visible flag of my group that contains all the line to false, my little red square (called 1:1) also disappear. This is not an issue with my code - I think - since whenever I toggle the visible flag directly from the console on the group, the red square also disappear.

I checked and the square is still visible.

I am just wondering why toggling the group has also an effect on the other object.
I can obviously provide more information if you need.

Thanks a lot!

pine thorn
#

Can you show your full scene graph?

frozen token
#

How can I do that? Do you want me to like copy paste the scene object from the console to here?

#

(sorry, very very new to ThreeJS haha)

pine thorn
#

You can show it in the console like, open your scene object's children, and their children and send a screenshot. I assume your scene is small enough to fit in one screenshot

frozen token
#

I hope that's good enough!

#

Thanks a lot.

#

In this situation, the group is set to visible = false but even the red square is not here anymore:

pine thorn
#

Where is the "1:1" object? Did you change its name to "0:0"?

frozen token
#

Oh yeah I did sorry. It's 0:0 now (the name reflect the position on the grid haha), but the issue is here on all squares. I have one here because I wanted to have a simple example but it is the same behavior with more squares 🙂

pine thorn
#

Mmm.. Nothing obvious springs to mind.
If you could provide a codepen example that would probably help people to help you. Not me currently as I won't be near a computer until tomorrow

#

Sorry

frozen token
#

No problem I will do that, thanks for taking the time!

faint drift
winter scaffold
#

hiding a group will hide everything in it

#

it wasn't always like that, and a much requested feature that i've seen them shoot down fervently on github, i don't know how it works and why, i just hope if it's a bug they don't see it because it absolutely should be like that 😂

pine thorn
#

His pixel object isn't inside a group

frozen token
#

Okay so just to keep you posted, I still don't have a simple codepen but while I was working on it I discovered something interesting.

Right now the background is first created, then the grid (I create all the lines, add them to a group and the group to the scene) and after that I add my pixel.

If I delay the grid creation (disabling it by default and having to wait for the user to click a toggle button for example) then it works as expected.

So I think the issue is a bit deeper. I will continue to remove what's unecessary to provide you with a codepen.

hard wren
winter scaffold
hard wren
winter scaffold
#

<mesh visible={false}>
<mesh visible={true}

i think some time ago only the first was invisible

#

it's probably unrelated to the topic, just read the title as always

pine thorn
#

I've been familiar with three.js for only two and a half years, and during that time this was never the case

#

I don't think it ever was

hard wren
#

and this would probably be very early