When I use setDisplaySize in matter, the image is the correct size, but the hitbox is way too big, how can I fix this?
an acceptable solution would be to fill the whole hitbox area with a color, but that is not ideal.
this will work
//before changing the hitbox, only add functions that will change the image of the object, but not the hitbox
this.sprite = this.matter.add.sprite(100, 100, ' ').setDisplaySize(width, height).setTintFill(0x00ff00);
// in matter, setDisplaySize will make the hitbox much bigger than needed but the image will be the correct size
//changing the hitbox here
this.sprite.setBody({
type: 'rectangle',
width: 600, //can do whatever width or height you want
height: 50
});
//add functions to the sprite that will affect the hitbox AFTER changing the hitbox
this.sprite.setAngle(angle);
this.sprite.setStatic(true);