Skip to content

Adding prefix to Object3D id #14217

@NicolasRannou

Description

@NicolasRannou

Using 2 different libraries (A and B) based on threejs.

Each library generates valid threejs meshes independently. However, the id of the meshes from library A and B can conflict (i.e. be the same). Then when we add meshes from library A and B into the same scene it does not render properly.

Is there a mechanism we can use to generate meshes independently and ensure IDs do not conflict while rendering it in the same scene?

One idea is to add a prefix concept:

Object.defineProperty( this, 'id', { value: object3DId ++ } );
=>
Object.defineProperty( this, 'id', { value: `${prefix}-${object3DId ++}` } );

Not quite sure which would be the best way to pass the prefix though.

Any thoughts on that?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions