Geaz Posted February 25, 2014 Share Posted February 25, 2014 Hi, the test on the following site works well on the desktop. But if I open it on a mobile device (ipad, iphone) all blocks seem to vibrate.Any clue why this happens (code viewable with webdev tools (firebug) - relevant files: start.js & field.js)? http://testphaser.boxxnet.de/ Thanks,Geaz Link to comment Share on other sites More sharing options...
Geaz Posted February 25, 2014 Author Share Posted February 25, 2014 BTW: Same problem with the "boxes everywhere" demo in the lab. Maybe a problem with P2? If I deactivate physics they don't vibrate. Link to comment Share on other sites More sharing options...
Geaz Posted February 25, 2014 Author Share Posted February 25, 2014 P2 demo is working: http://schteppe.github.io/p2.js/demos/collisions.htmlSeems to be a problem in phaser. Link to comment Share on other sites More sharing options...
valueerror Posted February 25, 2014 Share Posted February 25, 2014 No vibrating on the nexus 7.. Very nice game btw. Link to comment Share on other sites More sharing options...
rich Posted February 26, 2014 Share Posted February 26, 2014 Be sure that your Physics World properties match the p2 demo and it should sort it out. friction for example, maybe solver iterations. Have a dig around and see what p2 used and copy it Link to comment Share on other sites More sharing options...
Geaz Posted February 26, 2014 Author Share Posted February 26, 2014 HI and thanks for the replies! The demo uses another broadphase algorithm (SAPBroadphase). If i use it, it seems to help, but my collisions are not working anymore...anyone knows why? Otherwise I will try harder and look what I forgot Thanks,Geaz Link to comment Share on other sites More sharing options...
rich Posted February 26, 2014 Share Posted February 26, 2014 Phaser defaults to SAP as well, so it's not that. p2 World defaults are: gravity: 0, -9.78friction: 0.3 Phaser sets both of these to 0. So you may want to change back. Although I see the collision demo sets gravity to 10 (values are p2, not px) More importantly though he's adjusted the solver defaults: world.solver.iterations = 20; world.solver.stiffness = 1e4; world.solver.relaxation = 4;You can do the same via a physics configuration object in the game constructor. Link to comment Share on other sites More sharing options...
Geaz Posted February 26, 2014 Author Share Posted February 26, 2014 Unfortunately I can't get it working I tried the settings from the p2 demo, but it seems that I do something wrong. I'm able to set the iterations up, but then the fps drops... Link to comment Share on other sites More sharing options...
Geaz Posted February 26, 2014 Author Share Posted February 26, 2014 I found out, that resetting the anchor to 0,0 solves the problem. But the physics body are wrong then... Link to comment Share on other sites More sharing options...
rich Posted February 26, 2014 Share Posted February 26, 2014 Then it's likely not the physics causing it at all, but probably non-rounded pixel values. Try this:game.renderer.roundPixels = true;(not for webgl, only canvas) Link to comment Share on other sites More sharing options...
Geaz Posted February 27, 2014 Author Share Posted February 27, 2014 Unfortunately it did not help.I tried it with pure p2 and pixi - no phaser at all. Here as well: as soon as I set the anchor of the sprites to 0.5 they start "vibrating". So I normalized the p2 position values to fit an anchor at 0,0. Now I got no vibrations and correct physics. Link to comment Share on other sites More sharing options...
rich Posted February 28, 2014 Share Posted February 28, 2014 What size are your Sprites? Unless I'm mistaken they're 127x127 yes? I wonder if it's purely that (i.e. you can't divide it evenly, so it fluctuates between the pixels values when trying to use the anchor at 0.5). I.e. I wonder if a 128x128 sprite wouldn't exhibit the same behaviour? Geaz and opendevcode 2 Link to comment Share on other sites More sharing options...
Geaz Posted February 28, 2014 Author Share Posted February 28, 2014 Great idea Rich! Was the last thing I thought about. I tried it with 126x126px sprites and no vibration at all! Yeah! Link to comment Share on other sites More sharing options...
rich Posted February 28, 2014 Share Posted February 28, 2014 Awesome!! One for the documentation Fishrock123 1 Link to comment Share on other sites More sharing options...
Recommended Posts