Jump to content

collider doens't match a scaled sprite


Lotti
 Share

Recommended Posts

Hello! :)

 

It's my first time with phaser and i'm pretty excited about it. I'm making a very simple game just to see how I feel working with a library for html5 (I work with unity3d everyday).

 

I made 32x32 sprites and then I scaled them to different sizes: 0.3x0.3 and 0.5x0.5, I setted a circle collider, then i rendered the colliders with game.debug.renderPhysicsBody on "render loop" and I noticed that the colliders are not centered with the sprites! It does occurs only with scaled sprites.

here it is my code

        circle = game.add.sprite(100, 100, 'circle');
        circle.name = 'circle';
        circle.scale.setTo(0.3,0.3);
        circle.body.setCircle(circle.width/2);
        circle.body.bounce.y = 0.2;
        circle.body.gravity.y = 200;
        circle.body.collideWorldBounds = true;

 

I don't know if this behaviour is expect or it is a bug. If it is expect, how can i center the collider with the sprite? Thank you.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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