Letoc Posted September 11, 2016 Share Posted September 11, 2016 I have a 2D game world which I'm displaying top-down via an orthographic projection. I have a simple camera object which manages a stage for the viewport (HUD etc) and a stage for the world (Environment, players..) My world y-axis increases vertically, where as the screen y-axis decreases vertically. In order to translate from world coordinates to screen coordinates I need to reverse all the y position values. I was hoping there's a simple translation I could do for this but I can't figure it out. The only thing I got working kinda like how I want it is to scale y by -1 but that turns everything upside down which is definitely not what I want. Could anyone tell me what I should be doing? Thank you! Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 11, 2016 Share Posted September 11, 2016 http://pixijs.github.io/examples/#/demos/texture-rotate.js If you flip all your Texture's (rotate=8), it will work just fine. Quote Link to comment Share on other sites More sharing options...
Letoc Posted September 11, 2016 Author Share Posted September 11, 2016 I aren't using textures, just PIXI.drawRect and PIXI.Text for now, the issue I have is with PIXI.Text. Do I have to set the scale to each one as -1 or is there another way? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 12, 2016 Share Posted September 12, 2016 drawRect is member of PIXI.Graphics, its not an object. Text is also a sprite: myText.texture.rotate = 8 Quote Link to comment Share on other sites More sharing options...
Letoc Posted September 12, 2016 Author Share Posted September 12, 2016 Thanks, that does also work. I'm confused as to why this is so complicated, why do I have to change each individual component which I need to render the correct way up? Is there not a more sensible way to do all of this? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted September 12, 2016 Share Posted September 12, 2016 9 hours ago, Letoc said: Thanks, that does also work. I'm confused as to why this is so complicated, why do I have to change each individual component which I need to render the correct way up? Is there not a more sensible way to do all of this? We can add that setting in PIXI constants in the future. Its not that complicated, its just the way UV's are made. For now, you have to flip every texture. You can also make your own JS class on top of Text that will change rotation just after base constructor. Also, "rotation" isnt even member of ANY other 2d engine, it was my idea to introduce UV convertions in that form. Some engines have "flip-y" setting per texture, but its kind of a constant for file type 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.