I have a sprite that collides with a tilemap layer.
I was following the ourcade youtube example for the dungeon crawler series.
However, when my sprite collides with a wall tile, sometimes it shakes back and forth. Its not super noticeable unless the camera is following. in which case, it shakes the entire screen. I’m assuming its because phaser is pushing the sprite away from the tile after the collision.
The only thing Ive found to try is adjusting the tileBias value, which had no effect. Im looking for other things to try to prevent the shaking.
Thanks in advance!
Ive added a sample to github showcasing this behavior. clone the github and run ‘npm run start’
When colliding with the right side of the objects, you can see the behavior
I believe i found the root cause, but I am not closer to finding a solution.
The root cause is when I used texture packer to create the sprite animations, each frame has a separate pivot point. The body is tied to the pivot point selected. When the body changes position slightly due to the pivots, it messed with collisions.
Is there a way to create a separate body for collision purposes that is separate from frames created from an atlas?
Just in case someone is interested. I ultimately added my player sprite to a container, and used the container bounds as the hitbox for collisions against the tile layer. This allowed my spite animations to have various pivot points without modifying its hit detection.