brdmg Posted September 14, 2016 Share Posted September 14, 2016 Recently I've been developing small app for raspberry pi with few sets of sprites. I used PIXI.Container as stage for rendering with MovieClip objects inside of it. And it works fine. Then I tried to improve perfomances and changed PIXI.Container to PIXI.ParticleContainer(5000, {uvs: true }); It works fine on pc, but on pi i get error "TypeError: null is not an object (evaluating 'this.parent.transform')" which occurs in this part of pixi DisplayObject.prototype.updateTransform = function () { this.transform.updateTransform(this.parent.transform); // multiply the alphas.. this.worldAlpha = this.alpha * this.parent.worldAlpha; this._bounds.updateID++; }; I tested this part and it's used by PIXI.ParticleContainer and not PIXI.Container and i was wondering can i somehow avoid using this part of code Quote Link to comment Share on other sites More sharing options...
xerver Posted September 14, 2016 Share Posted September 14, 2016 Can you share the code? It shouldn't call updateTransform for sprites within a ParticleContainer at all. Can you trace a bit with remote debugging and see what you can find? (I don't have a PI) Quote Link to comment Share on other sites More sharing options...
brdmg Posted September 15, 2016 Author Share Posted September 15, 2016 my code is pretty straightforward so I'll write in short lines var renderer = new PIXI.autoDetectRenderer(300, 300, {transparent: true}); var stage = new PIXI.ParticleContainer(5000, {uvs: true}); stage.appendChild(renderer.view); then i load assets and create MovieClip object and append it to stage function createAnimation() { var frames = []; for(var i=75; i<150; i++) { frames.push(new PIXI.Texture(resources.texture, new PIXI.Rectangle(imgData[2],imgData[3], 238, 235))); //imgData is json with frames positions } return new PIXI.extras.MovieClip(frames); } So, i traced call stack and came up with this -It starts from WebGLRenderer.prototype.render if(!skipUpdateTransform) { // update the scene graph var cacheParent = displayObject.parent; displayObject.parent = this._tempDisplayObjectParent; displayObject.updateTransform(); displayObject.parent = cacheParent; // displayObject.hitArea = //TODO add a temp hit area } ParticleContainer.prototype.updateTransform = function () { // TODO don't need to! this.displayObjectUpdateTransform(); // PIXI.Container.prototype.updateTransform.call( this ); }; DisplayObject.prototype.updateTransform = function () { this.transform.updateTransform(this.parent.transform); // error // multiply the alphas.. this.worldAlpha = this.alpha * this.parent.worldAlpha; this._bounds.updateID++; }; Maybe I'm using wrong way for creating MovieClip? Quote Link to comment Share on other sites More sharing options...
xerver Posted September 15, 2016 Share Posted September 15, 2016 var renderer = new PIXI.autoDetectRenderer(300, 300, {transparent: true}); var stage = new PIXI.ParticleContainer(5000, {uvs: true}); stage.appendChild(renderer.view); You don't want that. You added the canvas of the renderer to the particle container, I think you meant to add the canvas to the document with document.body.appendChild(renderer.view). That may be causing your issue. Quote Link to comment Share on other sites More sharing options...
brdmg Posted September 16, 2016 Author Share Posted September 16, 2016 Sorry, i pasted wrong line, its container.appendChild(renderer.view). Everything works fine with Container but error occurs with ParticleContainer. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.