Jump to content

"e.scale is not a function" error on animation end.


andrew-m
 Share

Recommended Posts

Hi,

 

Complete newb to both Babylon and 3d in general, and I'm getting a mystery error at the end of an animation:

 

"TypeError: e.scale is not a function" (at line 10 of babylon.1.13.js)

 

Does anyone know if this is a common error, and what I've done to cause it?

 

You can see the offending scene here: http://www.flowerchild.org.uk/3dDogfight/ 

Hit the "a" key to trigger the animation. The animation seems to work OK (some rotation and translation), but no further animations will trigger. 

 

I'm afraid I haven't stripped it down to a minimal example, and I'm out of time tonight, but if necessary I can do that in the next few days time permitting.

 

Extra stuff:

The error happened with babylon.1.12 too.

I can only test in Firefox 30 (I'm on Ubuntu, and Chrome so far refuses to fathom my graphics drivers). 

I'm getting

 

Finally - big thanks to Temechon, who's Toad attack tutorial I've been following, and apologies to Temechon for probably not reading the tutorial carefully enough!

Link to comment
Share on other sites

Hey, 

 

Thank you for reading my tutorial :)

 

As AlexB asked, it would be easier to debug your code with a un-minified version of Babylonjs...

However, I think you may have discovered a bug...

 

A simple playground example to reproduce it : http://www.babylonjs.com/playground/#P5XVX (look at the console error).

 

I will try to debug it later today.

 

Cheers !

Link to comment
Share on other sites

Ok, I found it :)

 

It's a bug in babylon.js. The problem is here : 

Animation.prototype._interpolate : case Animation.ANIMATIONLOOPMODE_RELATIVE:    quaternion = this.quaternionInterpolateFunction(startValue, endValue, gradient).add(offsetValue.scale(repeatCount));    break;}

The problem occurs because the mode ANIMATIONLOOPMODE_RELATIVE is used on this animation, and because offsetValue equals 0 : scale is undefined on a float.

 

offsetValue equlas 0 because of this : 

Animation.prototype.animate :  var range = to - from; var ratio = delay * (this.framePerSecond * speedRatio) / 1000.0; if (ratio > range && !loop) {      offsetValue = 0;      returnValue = false;      highLimitValue = this._keys[this._keys.length - 1].value; } else {       //... }

We will need for someone to fix it, as I don't have any clue about how to do it.

 

As a workaround, you can use the mode ANIMATIONLOOPMODE_CYCLE in your animation.

 

Cheers !

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...