Shermz345 Posted January 26, 2018 Share Posted January 26, 2018 Hi, I'm making a top-down game with the camera that follows the player. Early on, I realized there was a persistent camera jittering effect when using velocity, so I switched my movement to manually change the players x & y coordinates. However, when I started adding enemies to the game that also had arcade physics bodies, I realized that my bodies would not collide. Looking into this, I found this response from the Phaser devs, saying that the problem would be solved in P2. I switched both my bodies to P2, but they still will not collide. Is there a way I can work around both the camera and collisions issue? Thanks in advance for the help. Link to comment Share on other sites More sharing options...
samme Posted January 26, 2018 Share Posted January 26, 2018 4 hours ago, Shermz345 said: Early on, I realized there was a persistent camera jittering effect when using velocity, so I switched my movement to manually change the players x & y coordinates. Usually this isn't caused by the velocity itself but by moving sprites by non-integer fraction amounts (which will happen if a velocity is not a multiple of the game frame rate, e.g., 60). You can try rounding body.position at the end of update(). Arcade collisions should separate bodies as long as at least one body is changing position. Arcade collisions will also accelerate bodies as long as at least one body has a non-zero velocity and a non-zero bounce. To fake that, you can copy the body's delta to its velocity, check the collision, then zero the velocity. Shermz345 1 Link to comment Share on other sites More sharing options...
Recommended Posts