Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tommyv

Pages: [1]
1
Support / Re: flip
« on: September 21, 2012, 09:25:30 pm »
I think I figured this out. The solution for me was to use rotation instead of scale to make the character (just a hierarchy of sprites) appear to face the opposite direction. I rotated the parent 180 degrees about the Y-axis so the camera sees the back of the sprites. Since the scale of the parent remains uniform, this doesn't trigger any of the aforementioned problems. I did have to re-position the individual sprites on the z-axis to make sure that the sprites layered as expected (the eye balls remained in front of the head and not covered up behind), but this was as easy as just negating the z component of each sprite's local position.

2
Support / Re: flip
« on: September 21, 2012, 09:07:10 pm »
I think I know what coolTool is talking about because I think I'm having the same issue. I don't think it's specific to 2DTK but maybe you can offer some advice either way. I've got a hierarchy of tk2dSprites that represent a character similar to the scary looking spider in one of the examples. I animate the character in Unity by rotating the individual sprites (the legs, arm, hands, etc). This works great until I want to flip the character on the x-axis, for example, to make the character run the opposite direction on screen. The easiest way to do this, as you said, is to just scale the parent GameObject by -1 on the x-axis. And as you said this will result in an additional draw call, which isn't too big of a deal at least in my case. The real problem is that if you try to rotate a child object that has a parent with a non-uniform scale (like -1, 1, 1), then the rotations break. For example the feet will appear to detach from the legs, which will appear to detach from the body.

I tired to fix this by abandoning the notion of scaling the entire character via the parent GameObject, and instead used the Scale property on the tk2dSprite component. I flipped the x scale (FlipX()) for each individual sprite of the character, and then transformed the position of each sprite across the local origin of the character. I ended up with a character that looked just like it'd been scaled at the parent when not being animated. However when animated it was clear that the animations themselves still behaved like the character was facing in the original direction (duh, I guess I should have expected this). This can't be fixed by just playing the animation backwards.

Any bright ideas? Thanks for the help.

3
Support / Re: How can I repeat texture on sprite several times?
« on: July 30, 2012, 08:33:49 pm »
Any word on this tiling capability?

Pages: [1]