Jump to content

Sprite polygonic hit area vs graphics draw


hexdecks
 Share

Recommended Posts

Hi All,

 

Apologies for the frequent posts - I'm finding my way with the Pixi API's.

 

I've run into a strange issue whereby I cannot set an accurate polygon hit area for a sprite. 

My understanding is this:

 

  • By default, all sprites will have a bounding rectangle as a hit area
  • For more complicated sprites, you can override this hit area using a new PIXI.Polygon (using Pixi.Points) to draw the relevant hit area polygon.
  • If I want to visualise this hit area, I can create a new graphics object and use lineTo / moveTo with the same x/y co-ords as my polygon hit area.

However, when feeding my coords to the graphics object, the graphics object fills perfectly over the sprite. However, when I set these same points (x,y) coords as the coords for my sprite polygon hit area - the hit test is all over the place. (I would expect the graphics object to accurately reflect the hit area as they share the same x/y points!)

 

Do I have a misunderstanding somewhere?

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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