GithubHelp home page GithubHelp logo

Comments (5)

vasturiano avatar vasturiano commented on July 22, 2024

@ingodahn thanks for reaching out.

I see that you're providing the exact same data object to both of the components. This may be the reason behind the issue, as some conflicts arise due to the same internal Three objects being shared between two different scenes (and using different renderers, webgl and VR).

Could you try the same example but with completely separate dedicated data objects for each. You could try deep cloning one object from the other, or simply re-generate a data object from scratch at import time.

Let me know if that leads to a different result.

from 3d-force-graph-vr.

ingodahn avatar ingodahn commented on July 22, 2024

from 3d-force-graph-vr.

vasturiano avatar vasturiano commented on July 22, 2024

@ingodahn ok thanks for making that new example. 👍

I think I found the resolution to this issue, and it's a weird one. You just need to swap the order of the component imports, so that the import of 3d-force-graph-vr happens before 3d-force-graph.

So simply replace this:

import Component1 from "./Component1.vue";
import Component2 from "./Component2.vue";

with this

import Component2 from "./Component2.vue";
import Component1 from "./Component1.vue";

The explanation behind why this works has to do with the way three declares itself as a global in the system. And to prevent having multiple instances of three being consumed when importing modules that require it, they first verify if there isn't already one defined in the module, before defining a new one. So, whichever import happens first is essentially defining the version of three that will be consumed by the other packages in the application.
Then the other element of this is how the VR module actually imports a customly modified/augmented version of three as it's required by the underlying dependency aframe. This augmented version has methods which are not present in the vanilla version of three consumed by 3d-force-graph. So basically the version imported by 3d-force-graph-vr can satisfy the requirements of 3d-force-graph, but not vice-versa. That's why the import of 3d-force-graph-vr needs to occur first.

from 3d-force-graph-vr.

ingodahn avatar ingodahn commented on July 22, 2024

from 3d-force-graph-vr.

vasturiano avatar vasturiano commented on July 22, 2024

@ingodahn the only part that makes a difference is that the module that imports aframe, f.e. 3d-force-graph-vr must always come first.

from 3d-force-graph-vr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.