I am trying to animate a plane by setting main texture offset and scale.
I extracted the frames of the animation created in flash. Trimmed each of them using photoshop to get a sequence of images of non uniform size.
Then I used texture packer to make a texture atlas and xml metadata.
Then I parsed the xml file and generated texture offset and scale for each frame using the following way.
Vector2 size = new Vector2( 1.0f/atlasWidth, 1.0f/atlasHeight )
for(int i=0; i<atlasData.Length;i++)
{
float invertedStartPixelY = atlasHeight - (atlasData_.startY + atlasData*.pixelHeigh);*_
animationData.frameTextureOffset = new Vector2(atlasData_.startX * size.x,
invertedStartPixelY * size.y);
animationData.frameTextureScale = new Vector2(size.x * atlasData*.pixelWide,*
size.y * atlasData*.pixelHeigh);
}*
The problem is I get unwanted texture scaling for some of the frames of the animation.
Am I calculating the texture scale correctly?_