Jump to content

The problem of physics Performance


375051821
 Share

Recommended Posts

Recently I am doing a project, in which I have to set a constant velocity value to a ball.

This game is much like PingPong.

I am now using P2 physics, but when test it on mobile, there are a big performance problem. On Android, the problem could be a small problem due to different browser, but it still remain somtimes, there is a little bit stutter when I playing.

Because I don't have the things like vector, so I can not get or set it's magnetic efficiently, so I have to calculate the angel and value of the velocity and set it to constant values every frame, I think this might be the main problem.

And I also want to know, if it's also because the P2 physics caused too much, I know that there are a box2d plugin in phaser, it costs a bit, but I want to know if my game's performance would become better if I change to box2D, what's the difference between box2d and p2.

And I also want to know if anyone could have a better solution to due with the constant velocity problem, I need it to bounce, and if it's possible I also want to constraint the angle, because I don't want the ball to bounce like parallel to the bouncing board.

Thanks a lot!

Link to comment
Share on other sites

I tried to change the objects' velocity in update loop, but now I have change it to be in the endContact function. However, it still remains slow, I am guessing if it's because the P2 don't have the continuous collision. Because my board is a polygon

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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