Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Odd results from masking display groups with trimmed children
Started by jhow Mar 12 2015 09:21 AM

No replies to this topic
group object masks spritesheet trim display group
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

jhow

[GLOBAL: userInfoPane.html]
jhow
  • Contributor

  • 159 posts
  • Enterprise

Hello,

 

I've been getting some weird results from my masks when attempting to mask a display group. Inside the display group are display objects from a trimmed sprite sheet. Here's an example as to what is happening:

 

Let's say my sprite sheet has two images, a face and hair for the top of the face. (I want to color the hair programmatically, which is why the hair and face are separate). The intention is to group the hair and face together in corona, the hair will overlap a bit of the face as well as jut out further north of the face (as if it were spike-y hair). 

 

Now, the images added to my TexturePacker file have the same sized art boards (which are the size as if the face and hair were a single image). Within each art board, the face or the hair are positioned exactly where I would like them to be. In other words, if I place the the hair object in the same position as the face object, then it would be as if the hair snapped into the correct position. This is true when creating the objects in the program. Note that both of these images are on the same spritesheet, which uses the Trimmed setting.

 

The single mask image created is essentially the silhouette of both these images together as if they were a single image. Also, it is the exact same dimensions and positioning as the art boards with the hair and face. The mask is mainly used for "touch" functionality (ie. detecting/handling when I'm touching either the face or hair or not)

 

Now the issue comes when I attempt to mask the display group that includes both of these objects. It appears as though the mask for touch purposes is getting cut-off at the top and bottom to a height smaller than a height which should be from the tip of the hair to the chin of the face.

 

Looking further into this, could this relate to the dimensions returned by a display group when using trimmed images. For instance, I'd expect the display group to be the same height from the tip of the hair to the chin of the face, but I noticed that it's actually smaller. Instead, the height of the display group is actually the height of the face frame in the lua file exported from Texture Packer. In practicality, the display group should be larger since it also includes the hair, which juts out the top of the face. 

 

I think the surface issue (ie. the mask getting cut off) is solvable by not trimming my spritesheets. But, it would be nice to use trimmed sheets to save space. Also, regarding the deeper level issue of the groups providing the wrong dimensions, I am curious as to why this unexpected and unintuitive result happens, and as to if it will be addressed in the future?

 

Thank you! :)

 

 




[topic_controls]
[/topic_controls]