krsbx / mind-ar-ts

A complete rewrite of Mind AR JS in TS
MIT License
23 stars 6 forks source link

mouse and gesture rotation doesn't work #121

Open BlyatifulWorld opened 1 year ago

BlyatifulWorld commented 1 year ago

Here is the link to my prod repo

The scanner page

Here's the snippet of what I've done

<a-scene mindar-image="imageTargetSrc: ./targets.mind; maxTrack: 9" color-space="sRGB" renderer="colorManagement: true, physicallyCorrectLights" vr-mode-ui="enabled: false" device-orientation-permission-ui="enabled: false" mouse-detector gesture-detector>
  <a-assets>
    <a-asset-item id="SC1" src="../assets/Models/MODEL/Science/SC1/B_1.gltf"></a-asset-item>
    <a-asset-item id="SC2" src="../assets/Models/MODEL/Science/SC2/B_2.gltf"></a-asset-item>
    <a-asset-item id="SC5" src="../assets/Models/MODEL/Science/SC5/SC5.gltf"></a-asset-item>
  </a-assets>

  <a-camera position="0 0 0" look-controls="enabled: false"></a-camera>
<!-- 1 -->
  <a-entity mindar-image-target="targetIndex: 0" mouse-rotation="rotationFactor: 5" gesture-rotation="rotationFactor: 2">
    <a-gltf-model rotation="0 0 0 " position="0 -0.25 0" scale="0.03 0.05 0.03" src="#SC1" animation-mixer>
  </a-entity>
<!-- 2 -->
  <a-entity mindar-image-target="targetIndex: 1">
    <a-entity mouse-rotation="rotationFactor: 5" gesture-rotation="rotationFactor: 2">
      <a-gltf-model rotation="0 0 0 " position="0 -0.05 0" scale="0.03 0.05 0.03" src="#SC2" animation-mixer>
      </a-entity>
    </a-entity>
<!-- 3 -->
  <a-entity mindar-image-target="targetIndex: 2">
    <a-entity mouse-rotation="rotationFactor: 5" gesture-rotation="rotationFactor: 2">
      <a-gltf-model rotation="0 0 0 " position="0 -0.25 0" scale="0.05 0.05 0.05" src="#SC5" animation-mixer>
    </a-entity>

</a-scene>

I just use pure html and just download mindar+image-aframe.prod.js and mindar-gesture.prod.js from your repo.

Here are what happened when I scanned

  1. I just add mouse/gesture to the first a-entity tag. This does show the model when I scan the image, though I can't use my mouse to rotate
  2. Add another inside the top one, and move mouse/gesture rotation into the nested tag instead. Doesn't work, but the model does show up.
  3. Remove one of the closing tag for just like yours. Doesn't even show the model.

Here are what I think might be the problem

  1. For the first one, honestly do not know. I'd wager it's because I don't nest .
  2. This one confuses me because I don't think I do anything wrong. Though animation in may be the problem as I just copied that from the original MindAR multi-track file.
  3. It's the closing tag, isn't it?

Here are what I've tried to fix what I think what I've been a problem

  1. I change from animation-mixer to what presents here and it just bobs around up and down the Y-axis as I put the position of the model in "0 -0.25 0" which is an expected behaviour.
  2. Add closing tag to 3. which fix the problem of the model not showing up, but then again I still can't rotate the model.

Any advices as to where I did wrong or how I should proceed from here are appreciated.

demisquare commented 1 year ago

Please check this issue https://github.com/krsbx/mind-ar-ts/issues/67.

KaranRandhir commented 1 year ago

Please check this issue #67.

having the same issue can u provide a working example including the scripts that you are using.