hexdecks Posted January 23, 2015 Share Posted January 23, 2015 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 areaFor 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? Quote Link to comment Share on other sites More sharing options...
hexdecks Posted January 24, 2015 Author Share Posted January 24, 2015 I have just had a thought. Are the hit area co-ords relative to the sprite anchor point? Quote Link to comment Share on other sites More sharing options...
whyameye Posted January 25, 2015 Share Posted January 25, 2015 yes the hit area is relative to the anchor point Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.