Skip to content
Discussion options

You must be logged in to vote

Genesis does not provide a built-in remove_entity() method. Once entities are added and the scene is built, they cannot be safely removed at runtime.

Solution

Rebuild the scene without the unwanted entity:

# Store entity specifications
entity_specs = []  # List of (morph, material, surface) tuples

# Destroy current scene
scene.destroy()

# Create new scene
scene = gs.Scene()

# Re-add only desired entities
for morph, material, surface in entity_specs:
    if should_keep(entity):  # Your condition
        scene.add_entity(morph, material, surface)

scene.build()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@simplestory
Comment options

Answer selected by simplestory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants