2D Toolkit Forum

2D Toolkit => Support => Topic started by: mike2d on May 26, 2013, 02:40:11 pm

Title: apply an animated sprite on a mesh
Post by: mike2d on May 26, 2013, 02:40:11 pm
is it possible with 2dtoolkit ?

i mean, first create a spritesheet, then an animation with 2dtk and apply this animated sprite on a mesh in unity ?

thus using complexe meshes and apply animated texture on them.

here's the mesh :
(http://mamistudio.biz/forums/2dtk_001.png)

i'd like to apply animated texture on each part of this wheel.
Title: Re: apply an animated sprite on a mesh
Post by: unikronsoftware on May 26, 2013, 06:46:20 pm
You can't apply an animated sprite onto a mesh. If you wish to do this, just using material offsets will be easier to deal with.
Animated sprites are realised using meshes, and applying to a custom mesh with all the optimizations that tk2d performs, will be very expensive indeed. It will be much much easier to simply use a normal texture with UV scale and offset.
Title: Re: apply an animated sprite on a mesh
Post by: mike2d on May 27, 2013, 07:38:57 am
ok thanks
Title: Re: apply an animated sprite on a mesh
Post by: mike2d on May 27, 2013, 08:38:48 am
i managed to iterate through a spritesheet but the hard task is to start from anywhere and stop anywhere in a spritesheet with loop options...
Title: Re: apply an animated sprite on a mesh
Post by: unikronsoftware on May 27, 2013, 11:49:52 am
Don't you just want to grab the animation clip and get the frames from there if you want to?
Again, the issue is gonna be applying the uvs to a model, it can be rotated, clipped, etc.
Title: Re: apply an animated sprite on a mesh
Post by: mike2d on May 27, 2013, 01:21:03 pm
i'm not sure to understand but as you suggested, i've done the script myself, not trying to use a tk2d animation sprite anymore.

so i made a 2k x 2k spritesheet myself, applied it on a mesh and that works but when it comes to looping on certain frames, that's where i get stuck...
Title: Re: apply an animated sprite on a mesh
Post by: unikronsoftware on May 27, 2013, 01:34:39 pm
If you're doing your own spritesheet, you can probably steal the logic from tk2d Sprite. I don't know what you've done, so I couldn't really help you with that. But you do have something that works - the tk2dAnimatedSprite, just use that as a basis for your stuff.