Arin D Posted May 14, 2019 Share Posted May 14, 2019 Hi, i have a a sprite , hierarchy as follows mainContainer.childContainer1.sprite const app = new PIXI.Application({..... const renderer = app.renderer renderer.render(mainContainer) I can find the world x and y of sprite, but how do i set those values? I mean I want to change those values with respect to canvas. Using pixi 5 legacy thanks Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 14, 2019 Share Posted May 14, 2019 if you use `render()` directly and not from application ticker, you should use `new PIXI.Renderer`, not the application. https://github.com/pixijs/pixi.js/wiki/v5-Custom-Application-GameLoop As for coordinates problem, something like "mainContainer.toLocal(globalPos, undefined, sprite.position)" should work. that means it will convert globalPos to local coordinates of mainContainer and put it all to "sprite.position". Its not easy to explain this. Every time I use that thing, I open "DisplayObject.js" source code to remember how exactly does it work. Quote Link to comment Share on other sites More sharing options...
Arin D Posted May 15, 2019 Author Share Posted May 15, 2019 Thanks for the reply ? if I use new PIXI.Renderer, i get error " This browser does not support WebGL. Try using the canvas renderer", where is the fallback to canvas ? i thought pixi 5 legacy maintains the fallback to canvas ? and mainContainer.toLocal(globalPos, undefined, sprite.position) did not do what i intended to do, there is also lack of sufficient documentation to get help on this, all i want is to change x and y of sprite with respect to global (world), anyway, will keep trying Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted May 15, 2019 Share Posted May 15, 2019 there's "PIXI.autoDetectRenderer(options)" that creates appropriate renderer for you. 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.