Hello Guest

Author Topic: Newbie Collision Problem  (Read 3827 times)

chusek007

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Newbie Collision Problem
« on: November 16, 2012, 08:07:29 am »
I don't get it. Why do we add collision to the sprite collection ? Shouldn't we add it to the sprite ? The sprite has the Box Collider. The animated sprite has the Create Collider. Are they the same thing ?

And Box collider vs The one we gave to the sprite collection ??


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Newbie Collision Problem
« Reply #1 on: November 16, 2012, 09:14:49 am »
That is because the collider on a sprite is usually dependent on the sprite itself. If you create 10 instances of the same sprite, you tend to want the same collider on each, especially when its a polygon collider.

If you dont want to do this, or it doesn't fit in your workflow, simply set the collider type to Unset / UserDefined and create whatever you like on the sprite itself.

The animated sprite's "Create collider" is for weird cases where your animated sprite plays animations which don't have colliders set up by default, and then later you switch to one which does have colliders. It saves the runtime allocation and collider creation (which is slow) and does it on startup to save a frame rate hitch.