How do I remove objects from scene

Home Forums Puzzles How do I remove objects from scene

This topic contains 8 replies, has 4 voices, and was last updated by Avatar madbat 2 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #18501
    Avatar
    madbat
    Newbie

    Hey!

    I can append scene and clone objects, But how do I remove objects that I have cloned?
    Like what you do with verge3d :)

    // Patrik

    #18508
    Yuri Kovelenov
    Yuri Kovelenov
    Developer

    Hi,

    You can do it with JavaScript as per method #2 of our JavaScript guide:

    Here is a Puzzle snippet for calling this function:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #18514
    zjbcool
    zjbcool
    Licensee

    Oh,I think we can create a partical system using puzzle now.

    • This reply was modified 2 months ago by zjbcool zjbcool.

    ——https://zjbcool.com/

    #18520
    Yuri Kovelenov
    Yuri Kovelenov
    Developer

    partical system using puzzle now

    Would be interesting to see if this can work :good:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #18531
    Avatar
    jem
    Licensee

    Hi Yuri,
    I do not wish to complicate this topic, but I do wonder if the remove() function is sufficient to completely remove an object and its data from memory? There are a few threads about this on Stack Exchange and a page in the Three documentation (https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). I wrote a function to do this that removes the object from the scene and also disposes of the data. My hope was this approach would free up memory better than using remove() alone. What is the opinion of the Soft8soft team?
    Thank you.

    • This reply was modified 2 months ago by Avatar jem.
    #18533
    Yuri Kovelenov
    Yuri Kovelenov
    Developer

    if the remove() function is sufficient to completely remove an object and its data from memory?

    Indeed, calling dispose() for both geometry and the material is necessary to free memory occupied by an object’s resources. Thank for sharing the snippet! :good:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #18535
    Avatar
    jem
    Licensee

    Oops. I was editing my previous post in an attempt to fix the formatting of the JavaScript code and the forum software seems to have deleted the post. Apparently square brackets can cause issues. At risk of double posting, here is my original post that Yuri responded to (with the JS code now included as an image).
    ———————-
    Hi Yuri,
    I do not wish to complicate this topic, but I do wonder if the remove() function is sufficient to completely remove an object and its data from memory? There are a few threads about this on Stack Exchange and a page in the Three documentation (https://threejs.org/docs/#manual/en/introduction/How-to-dispose-of-objects). I wrote a function to do this that removes the object from the scene and also disposes of the data. My hope was this approach would free up memory better than using remove() alone. What is the opinion of the Soft8soft team?
    Thank you.

    Attachments:
    You must be logged in to view attached files.
    #18538
    Yuri Kovelenov
    Yuri Kovelenov
    Developer

    It happens sometimes with the syntax highlighting add-on we’re using. We should probably find a better one. :scratch:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #18545
    Avatar
    madbat
    Newbie

    Thanks for quick reply. :good:

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.