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 - roid100

Pages: [1]
1
Support / Re: How do I read UV values?
« on: March 25, 2013, 01:27:17 pm »
Yes!
I've checked it, and it had been rotated.
One more question please.
Is there easy way to check if it is roated or not in script?
If there is, how can I do?

2
Support / How do I read UV values?
« on: March 25, 2013, 09:35:28 am »
Hello,
When I searched the boards, I found this way to calculate the posion of Uvs.

float fX = (sourceTexture.width) * UVs[0].x;
float fY = (sourceTexture.height) * UVs[2].y;
float fX2 = (sourceTexture.width) * UVs[1].x;;
float fY2 = (sourceTexture.height) * UVs[0].y;
float fWidth = fX2 - fX;
float fHeight = -(fY2 - fY);

Almost of all sprite has no problem with this code,
but just some of sprites in the same Collection has got a problem.
They have zero value for 'fWidth'

I attached a JPG.
As you see, some of my sprites has the same value for Uvs[0].x and Uvs[1].x

What is the problem?
How can I read the value of Uvs?

Help me please~~

3
That's it!!!
Thank you very much!
You are a super hero!!

4
Hello,

tk2dAnimatedSprite img = GetComponent<tk2dAnimatedSprite>();
Texture2D t = (Texture2D)img.Collection.textures[0];
Color[] cs = t.GetPixels();

in this code,
cs.width is Atlas's width (Pixel).
cs.height is Atlas's height (Pixel).
Isn't it? cs is the data for the whole atlas pixels.

Can I know the Rect data for each sprite?
I mean... there are so many sprites in tk2dAnimatedSprite.
I want to know the color data of each sprites.
something like this...

tk2dAnimatedSprite img = GetComponent<tk2dAnimatedSprite>();
Texture2D t = (Texture2D)img.Collection.textures[0];
Color[] cs = t.GetPixels();
for ( int i = x, i < x + rectWidth; i++ ){
  for ( int j = y, j < y + rectWidth; j++ ){
     print( cs[ y * t.width + x ] );
  }
}

But I don't know how to find rectWidth and rectWidth...
Help me please... T.T


5
Support / Re: How can I change the sprite? Help me plz
« on: February 27, 2013, 05:22:25 am »
I've just updated it. Thanks a lot!

6
Support / How can I change the sprite? Help me plz
« on: February 26, 2013, 03:13:09 am »
Hello,
I am almost the beginner.
I searched and use this way to change the sprite image.

tk2dSprite img =  GetComponent<tk2dSprite>();
img.collection = (tk2dSpriteCollectionData) Resources.Load ("World1", typeof(tk2dSpriteCollectionData));
img.SwitchCollectionAndSprite(img.collection, img.GetSpriteIdByName("test"));

When I tested it,
the names of collection and sprite in the Inspector were changed.
But not changed in the game view ( also scene view ).

What is the problem? Please help me.
Many Thanks.

Pages: [1]