gftruj / aframe-hand-tracking-controls-extras

a-frame hand tracking extras
MIT License
51 stars 15 forks source link

Incompatibility with A-Frame 1.6 #9

Open filandra opened 4 months ago

filandra commented 4 months ago

When using A-Frame 1.6, the coordinates of joints are shifted and do not correspond to the real life counterparts at all. This issue is not present in A-Frame 1.5.

gftruj commented 4 months ago

Hey, thanks for reporting the issue, I'll check it out!

gftruj commented 3 months ago

I'm having trouble reproducing the issue with 1.6.0, any code sample/glitch that could help me out? I'm trying with my visual debug (but with the version bumped up).

filandra commented 3 months ago

Hmm I actually can't replicate the issue using the visual debug as well. I will write a simple demonstrator and get back to you. Perhaps the issue is actually in A-Frame, because I encounter the bug after using some vector math on the data from hand-tracking-extras.

gftruj commented 3 months ago

That would be great! I'll also try to bump my stuff to 1.6 or master and maybe something will pop up

filandra commented 1 month ago

I finally got to write the demonstrator - sorry for the delay:

AFRAME.registerComponent("version-test", {
  init() {
    this.ringHolder = document.createElement("a-entity");
    this.el.appendChild(this.ringHolder);

    this.ring = document.createElement("a-torus");
    this.ring.setAttribute("color", "green");
    this.ring.setAttribute("radius", 0.045);
    this.ring.setAttribute("radius-tubular", 0.0005);
    this.ringHolder.appendChild(this.ring);

    this.onHandTrackingLoaded = this.onHandTrackingLoaded.bind(this);
    this.el.addEventListener(
      "hand-tracking-extras-ready",
      this.onHandTrackingLoaded
    );
  },

  onHandTrackingLoaded(evt) {
    this.jointAPI = evt.detail.data.jointAPI;
  },

  moveRing() {
    this.indexBone.getPosition(this.ringHolder.object3D.position);
    this.indexBone.getQuaternion(this.ring.object3D.quaternion);
  },

  tick() {
    if (!this.jointAPI) return;
    if (!this.indexBone)
      this.indexBone = this.jointAPI.getIndexIntermediate();
    this.moveRing();
  },
});
<a-entity
    id="rightHand"
    hand-tracking-controls="hand: right;"
    hand-tracking-extras
    foo
    version-test
>

Version 1.5: 462548278_3556261524672734_5879531547526585669_n

Version 1.6: 462543459_1352675399319271_4987718125347318573_n

Still not sure if the issue is in A-Frame, hand-tracking-extras or perhaps I'm doing something wrong in the demonstrator.