Jump to content

Stuggling with some 2D transforms


Letoc
 Share

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...