Hello Guest

Author Topic: apply an animated sprite on a mesh  (Read 7000 times)

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
apply an animated sprite on a mesh
« 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 :


i'd like to apply animated texture on each part of this wheel.
« Last Edit: May 26, 2013, 03:19:55 pm by mike2d »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: apply an animated sprite on a mesh
« Reply #1 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.

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: apply an animated sprite on a mesh
« Reply #2 on: May 27, 2013, 07:38:57 am »
ok thanks

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: apply an animated sprite on a mesh
« Reply #3 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...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: apply an animated sprite on a mesh
« Reply #4 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.

mike2d

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 63
    • View Profile
Re: apply an animated sprite on a mesh
« Reply #5 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...

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: apply an animated sprite on a mesh
« Reply #6 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.