argonjs / argon-aframe

glue to use aframe to author argon applications
https://aframe.argonjs.io
MIT License
45 stars 18 forks source link

Difference in animation speed of animated 3d model between <a-scene> and <ar-scene> #4

Closed xemnas214 closed 8 years ago

xemnas214 commented 8 years ago

I tried with this simple example of imported animated model from both a-scene and ar-scene

https://github.com/donmccurdy/aframe-extras/blob/master/examples/animation/index.html

The animation runs unreasonably fast in compared to

I found the reasons for that is the timeDelta in argonUpdate function

    argonUpdate: {
        value: function (frame) {
            var time = frame.systemTime;
            var timeDelta = frame.deltaTime;

            if (this.isPlaying) {
                this.tick(time, timeDelta);
            }

            this.time = time;   
        },
        writable: true
    },

The variable timeDelta is much higher in ar-scene compared to a-scene (300 to 16) that makes the animation skips the frame. If I change the code to

var timeDelta = time - this.time;

(which is similar to how aframe defines timeDelta), the animation would run normally.

blairmacintyre commented 8 years ago

I think this is actually a bug in argon.js. This is the only place we have used deltaTime, which I modified argon to compute from it's time values (since it already had these values). But, I just found a typo in the code, I just fixed it. We'll get the new version up. I'm going to update the argon.js in the resources/js here

blairmacintyre commented 8 years ago

BTW, the reason I didn't notice it before is the only animation we were doing was using the Tween library, and it takes only time, not deltaTime.

blairmacintyre commented 8 years ago

ok, update is checked in. Please try it.