这是indexloc提供的服务,不要输入任何密码
Skip to content

Add ability to add networked entity to non-networked parent #400

@Agupta00

Description

@Agupta00

What

From my understand there is no way to add a networked entity to a specific part in the DOM unless the networked entity has a networked parent. The way to work around this behavior is to create a nested list of networked components that are "no-ops" (ie don't sync any data), but this doesn't seem ideal API wise.

An example use case of why this feature may be beneficial is, I have a platform in my scene that I want entities to spawn to, but I don't want to have the platform itself have a networked component. You can imagine that this platform is deeply nested in my a-cene.

For example: The entity two here will end up as a child of the 'a-scene`.

my client:

<a-scene>
     ....... //a bunch of other parents
       <a-entity id="one" platform>
            <a-entity id="two" networked/>
       </a-entity>
</a-scene>

other client:

<a-scene>
       <a-entity id="one" platform>
            <a-entity id="two" networked/>
            // WANT IT ADDED HERE 
       </a-entity>
       // ADDED HERE
        <a-entity id="two" networked/>
</a-scene>

This can be done pretty easily it looks like from the current logic by adding another attribute to the networked component. Something like attachToNonNetworkedParent which if specified adds the networked component to the right place in the DOM using its parent's id to find who the parent in the other clients scene is.

Let me know if this sounds good, and I can look into sending a PR :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions