Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_modules animation-mixer not working #605

Open
acarnagey opened this issue May 22, 2024 · 5 comments
Open

node_modules animation-mixer not working #605

acarnagey opened this issue May 22, 2024 · 5 comments

Comments

@acarnagey
Copy link

acarnagey commented May 22, 2024

Do you want to request a feature or report a bug?
Report a bug

What is the current behavior?
When I use nextjs / webpack /node_modules the animation-mixer does not work, but it works with pure html / js
If the current behavior is a bug, please provide the steps to reproduce.
create a nextjs project (or any project that uses node_modules)

npm install @ar-js-org/ar.js aframe aframe-extras`
{
 ...
     "@ar-js-org/ar.js": "^3.4.5",
     "aframe": "^1.3.0",
    "aframe-extras": "^7.2.0",
}

render a client component like

import "aframe";
import "@ar-js-org/ar.js";
import "aframe-extras";

<a-scene>
<a-marker preset="hiro">
<a-entity
  position="0 0 0"
  rotation="-90 0 0"
  scale="3 3 3"
  gltf-model="/t3.glb"
  animation-mixer
    ></a-entity>
  </a-marker>
</a-scene>

The 3d model shows up but does not animate, where as w/o node_modules it works and animates

<!DOCTYPE html>
<html>
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="https://raw.githack.com/AR-js-org/AR.js/dev/aframe/build/aframe-ar.js"></script>
<script src="https://cdn.jsdelivr.net/gh/c-frame/aframe-extras@7.2.0/dist/aframe-extras.min.js"></script>
<body style="margin : 0px; overflow: hidden;">
  <a-scene>
    <a-marker preset="hiro">
      <a-entity position="0 0 0" rotation="-90 0 0" scale="3 3 3" gltf-model="./3d3/t3.glb" animation-mixer></a-entity>
    </a-marker>
    <a-entity camera></a-entity>
  </a-scene>
</body>
</html>

Please mention other relevant information such as the browser version, Operating System and Device Name
Brave Version 1.66.110 Chromium: 125.0.6422.60 (Official Build) (64-bit) Ubuntu 24.04 LTS Desktop computer
What is the expected behavior?
Should animate the glb 3d asset
If this is a feature request, what is motivation or use case for changing the behavior?

@acarnagey acarnagey changed the title animation-mixer not working node_modules animation-mixer not working May 22, 2024
@vincentfretin
Copy link

I know nothing about nextjs so I can't help you with this specific setup. But I have a project using just webpack and a static index.html, that works fine using aframe cdn or npm dependencies.
Your above configuration doesn't make any sense, are you using npm dependencies or the cdn? Please use one or the other, not both. Do you have any errors in the console?

@acarnagey
Copy link
Author

acarnagey commented May 22, 2024

Thanks for the quick response, everything works, like the 3d model displays in the camera above the marker, except for the animation when node_modules and import syntax basically.

I know nothing about nextjs so I can't help you with this specific setup. But I have a project using just webpack and a static index.html, that works fine using aframe cdn or npm dependencies.

I think this would be the same with webpack, if you could share your code where the animation works with glb and animation-mixer that would be helpful for me if it works to see if I am doing some setup incorrectly.

Your above configuration doesn't make any sense, are you using npm dependencies or the cdn? Please use one or the other, not both. Do you have any errors in the console?

I am saying if I use import and node_modules animate doesn't work, this is what I am using and would like to get working, I am just saying that my glb 3d asset and animation normally works when using a cdn , I don't see any console errors. But these are the logs I see around aframe / ar.js when the page loads

A-Frame Version: 1.5.0 (Date 2023-11-14, Commit #7856a058)
page.js:5023 THREE Version (https://github.com/supermedium/three.js): 0.158.0
page.js:5023 WebVR Polyfill Version: ^0.10.12
page.js:7471 WARNING: Multiple instances of Three.js being imported.
eval @ three.cjs:50433
...
page.js:8238 WARNING: Multiple instances of Three.js being imported.

@vincentfretin
Copy link

If you see the "WARNING: Multiple instances of Three.js being imported." message that's not normal with latest aframe-extras. Double check you don't include the scripts twice.
I have an example of webpack config and static index.html in https://github.com/networked-aframe/naf-valid-avatars/ using a components bundle and defer ui bundle. That example uses aframe and aframe-extras with cdn in index.html. But you can put aframe and aframe-extras imports in src/components.js instead, that will work the same.

@acarnagey
Copy link
Author

acarnagey commented May 28, 2024

Thanks but this doesn't explain the reported issue, it animated for me with cdn in index.html, my issue I am reporting it is doesn't animate when I try to import aframe, aframe-extras, & @ar-js-org/ar.js as node modules.

@vincentfretin
Copy link

You will have a better change someone to help with your issue if you share a link where we can reproduce it. You can create a bare minimum NextJS app with one model that has an animation on https://glitch.com/~aframe for example.

Also be sure that the scripts mainly aframe-extras that includes animation-mixer component are loaded before the a-scene is created. NextJS may auto add a defer script for example that's not compatible with having a a-scene in index.html, you would need to configure the script insertion to not be defer or create a-scene dynamically when you're sure the scripts are loaded. I don't know this stack so can't help you further on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants