375051821 Posted July 30, 2015 Share Posted July 30, 2015 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 More sharing options...
375051821 Posted July 31, 2015 Author Share Posted July 31, 2015 Hello? Could Anyone help me? Link to comment Share on other sites More sharing options...
tips4design Posted July 31, 2015 Share Posted July 31, 2015 Hello. Are you sure the performance problem is because of P2JS ? I also used P2JS on several projects and did not have performance issues. What do you mean by constant velocity? Are you trying to change objects positions in the update loop, interfering with the physics engine? Link to comment Share on other sites More sharing options...
375051821 Posted July 31, 2015 Author Share Posted July 31, 2015 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 More sharing options...
375051821 Posted July 31, 2015 Author Share Posted July 31, 2015 Because I think the speed is not slow. Link to comment Share on other sites More sharing options...
Recommended Posts