seiyria Posted September 13, 2014 Share Posted September 13, 2014 When I load my entities from a tilemap, some of them are misaligned, for example: (magenta and teal are off a little bit) so I shift these particular objects with x+16, y-4 and I get: (both red) now they're both aligned correctly. My question is, is there some setting I have to change when creating objects? Having these adjustments, and then having to rotate some bodies, is more frustrating than it should be! Nothing seems to line up like it should. Link to comment Share on other sites More sharing options...
Arcanorum Posted September 14, 2014 Share Posted September 14, 2014 (edited) Looks like something to do with the bodies' anchors. The first image appears to have the anchor in the center of each body. This came to mind: http://examples.phaser.io/_site/view_full.html?d=tilemaps&f=create+from+objects.js&t=create%20from%20objectsSome of the signs and boxes have a weird offset too. So it turns out that when a game object is enabled for P2 physics it has its anchor x/y set to 0.5. Edited September 14, 2014 by Arcanorum Link to comment Share on other sites More sharing options...
seiyria Posted September 14, 2014 Author Share Posted September 14, 2014 Hm. I wonder what to do about that then? Should the anchor be set to 0,0? Or maybe I should just make sprites for each rotation, haha. I originally wanted to save on spritesheet usage and just rotate my sprites, which worked for Arcade. Just gave it a roll yesterday with p2 and it does not seem to like that very much. Link to comment Share on other sites More sharing options...
Recommended Posts