Hi
I am getting an error when using tween in a script where the.app.fire is undefined (see below), I can access it in the initialize method, is this a scoping issue? The tween is working as expected and hitting the complete method. Thanks for any help.
Cheers
Badu
Tween code:
this.entity
.tween(this.entity.getLocalPosition())
.to(new pc.Vec3(this.entity.getLocalPosition().x, this.entity.getLocalPosition().y, -0.007), 2.0, pc.SineOut)
.on('complete', function () {
this.inPosition = true;
this.moving = false;
this.app.fire("input:ready");
})
.start();
Error (Stack trace):
[ball.js?id=8286523:36]: Uncaught TypeError: Cannot read property âfireâ of undefined
TypeError: Cannot read property âfireâ of undefined
at Tween. (launch.playcanvas.com/api/assets/files/scripts/ball.js?id=8286523:36:21)
at Tween.fire (code.playcanvas.com/playcanvas-stable.dbg.js:608:18)
at Tween.update (launch.playcanvas.com/api/assets/files/scripts/tween.js?id=8286295:405:26)
at TweenManager.update (launch.playcanvas.com/api/assets/files/scripts/tween.js?id=8286295:24:37)
at Application. (launch.playcanvas.com/api/assets/files/scripts/tween.js?id=8286295:672:39)
at Application.fire (code.playcanvas.com/playcanvas-stable.dbg.js:608:18)
at Application.update (code.playcanvas.com/playcanvas-stable.dbg.js:19544:10)
at code.playcanvas.com/playcanvas-stable.dbg.js:19879:11