Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding viewport to layers #55

Open
TytiX opened this issue Apr 25, 2020 · 4 comments
Open

Adding viewport to layers #55

TytiX opened this issue Apr 25, 2020 · 4 comments

Comments

@TytiX
Copy link

TytiX commented Apr 25, 2020

Hi,

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

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

  • when panning -> light move (it's supposed to be attach to the red dot...)
  • ambiant light is only defined on the initial viewport (zoom out and there is a gray square)

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

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

@ivanpopelyshev
Copy link
Collaborator

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
Copy link
Author

TytiX commented Apr 26, 2020

nailed it!

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

@ivanpopelyshev
Copy link
Collaborator

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants