Geaz

"Vibrating" blocks on mobile devices

Recommended Posts

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

Share this post


Link to post
Share on other sites

Phaser defaults to SAP as well, so it's not that.

 

p2 World defaults are: 

 

gravity: 0, -9.78

friction: 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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.