Jump to content

getbounds not including rotation


Recommended Posts

I'm using getBounds for hit detection and getBounds doesnt seem to return the bounds with rotation on the object.

The sprite is being created and added to the scene and thats it before i query it's bounds. I've tried with and without .calculateBounds() before .getBounds()

var card = new Sprite(Resources.cardBack.texture);
card.x = (30 - getRandomInt(120)) + (col * 150) + width / 4;
card.y = (30 - getRandomInt(60)) + (row * 100) + 30;
card.interactive = true;
card.cursor = 'pointer';
card.name = "card"+i;
card.scale.x = _card_scale;
card.scale.y = _card_scale;
card.hitArea = new PIXI.Rectangle(11, 11, 130, 180);
card.rotation = degreesToRadians(getRandomInt(180)-90);


Link to comment
Share on other sites

13 minutes ago, ivan.popelyshev said:

a hack. Because of pixi transforms strange behaviour.

let tempContainer = new Container();

//sometimes later
container.addChild(sprite); //automatically removed from temp one


will give it ago, thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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