Jump to content

Inverted Y axis for physics


alex_h
 Share

Recommended Posts

P2.js operates with an upwards pointing y axis, whereas PIXI has its y axis the other way up. In the p2 examples the PIXI js one works around this by simply nesting everything in a DisplayObjectContainer and inverting its y scale property. I am curious to know whether this is the approach that Phaser takes too? I spent some time rummaging around in the Phaser source code but was not able to find the relevant portion. If anybody knows what Phaser does under the hood to address the conflicting y axis issue I'd be very interested to know.

Link to comment
Share on other sites

Oh cool thanks - how did I miss that?! Interesting to see that you are inverting the x axis too - perhaps that's what is missing from my own experiment! I've been trying out something similar in a non-Phaser environment to invert the y values on drawing the bodies but as soon as I start applying any rotation forces things started going a bit inside out and upside down. Glad to hear that the negative y scale shortcut is not being considered an approved solution  ;)

 

[EDIT] yep, adding inversion to the x axis as well fixed the problems I was getting - thanks again Rich [/EDIT]

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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