pixijs / layers

Separate the z-hierarchy of your scene tree from its canonical structure.
https://pixijs.io/layers/docs/
MIT License
224 stars 57 forks source link

Adding viewport to layers #55

Open TytiX opened 4 years ago

TytiX commented 4 years ago

Hi,

I tried to put pixi-layers in a viewport (with pixi-viewport).

I have achivied a render but interactions are not working...

see source sample : https://stackblitz.com/edit/rxjs-xupagq

oddly when commenting the line 74 (lighting not working) -> interactions are working again

ivanpopelyshev commented 4 years ago

Hello!

Thanks for sharing the demo. yes, there was a report that lighting + viewport = broken interaction.

I can look at it next week.

Are you sure that your layers themselves aren't controlled by viewport, only world is?

TytiX commented 4 years ago

nailed it!

the lighting layer was attached to viewport and not app stage... app.stage.addChild(lightingSprite); thx

ivanpopelyshev commented 4 years ago

app.stage.addChild(lightingSprite);

yeah, because that texture is already taken from the screen coords, and you dont need to scroll/scale it :) I think someone had that problem already ...

BrianRosamilia commented 4 years ago

I ran into this also haha. Don't be like me and try to open up pixi-viewport and make the Viewport class inherit from Stage instead of Container and just adding your lighting directly to that thinking you will solve this problem (you wont). It will actually render everything properly but it will not pan the lighting layer properly when you move the viewport and you arent any closer to solving it.

Solve it the way OP solved it in their working example https://stackblitz.com/edit/rxjs-xupagq