Hello Guest

Author Topic: Mesh colliders not updating with frames  (Read 3789 times)

Copywright

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 33
    • View Profile
Mesh colliders not updating with frames
« on: May 01, 2013, 05:19:18 am »
Hey,

I set up a large collection of sprites with 2DColliderGen, and it made some great mesh colliders for them. I play them in unity, but the meshes don't update based on the frame and sprite currently playing.

I get no errors or anything in the console. Any idea how to fix?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Mesh colliders not updating with frames
« Reply #1 on: May 01, 2013, 10:15:18 am »
The mesh colliders don't update with sprites, and for good reason - they cost a LOT to create and modify at runtime. You could probably get away with it if you only ever had one sprite you were doing this on, etc.

One alternative way to doing this is to create all your sprites, and then only display the frame you need. Again, this only works if you have a finite set of frames you want to switch between - 2D Toolkit has no such constraint, and implementing something like that into the core system would be a bad idea.

We'll be adding multiple box collider support in a future version (after 2.0) - that way you'll be able to animate complex colliders out of boxes. Its a much more efficient way to do things than using polygon colliders.

Copywright

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: Mesh colliders not updating with frames
« Reply #2 on: May 01, 2013, 07:15:43 pm »
Ah, I got it. It's not much of a problem, I wanted to play around with pixel-perfect collisions, but it's not that important. I'll switch to box colliders until that release then! Thanks for the support!