Author Topic: Best/Fastest way to make objects visible/invisible  (Read 212 times)

Offline Melssj5

  • double
  • *****
  • Posts: 724
    • View Profile
Best/Fastest way to make objects visible/invisible
« on: April 01, 2018, 06:29:23 am »
Hi friends, I am soing an app in which I must show or hide objects from my world depending on the user input..... Actually I am doing:

1: Clean (Remove all the objects3D that chould be hidden, some of them are not even in the world)
2: Adding to the world all the objects from (1:) that have to been shown
3: build the objects
4: render the world


I am constantly receving error messages that the object didnt exists on the world when trying to remove them.....

Will this way affect performance ans estability??

Which should be the best way to show or hide objects from my world. Maybe moving them to a far position out of the camera scope instead of removing them and moving them again instead of rebuilding them??? wich other aproach should I use??
Nada por ahora

Offline AeroShark333

  • long
  • ***
  • Posts: 173
    • View Profile
Re: Best/Fastest way to make objects visible/invisible
« Reply #1 on: April 01, 2018, 03:28:42 pm »
I thought Object3D had a method to set their visibility, not quite sure though.
Object3D.setVisibility(false);

Another solution could be to place the Object3D 'behind' the camera

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11853
    • View Profile
    • http://www.jpct.net
Re: Best/Fastest way to make objects visible/invisible
« Reply #2 on: April 05, 2018, 06:53:09 pm »
Yes, just set the visibility to false. That's cheap. You can have hundreds of invisible objects in a scene. It shouldn't hurt.