Hello Guest

Author Topic: problem with collision between sprite and animated sprite  (Read 4793 times)

sturmburg

  • Newbie
  • *
  • Posts: 4
    • View Profile
problem with collision between sprite and animated sprite
« on: April 16, 2013, 02:57:10 pm »
Hi,

Just started using 2D Toolkit and am new to working with sprites, so please forgive the newbie question.  I'm not getting any collision between an animated sprite and sprite in my scene.  My sprite has a box collider attached to it.  My animated sprite has a rigid body component on it (with gravity and kinematic checked) and also a box collider.  The box collider acts strange though.  Even though I set its size and center values the inspector when I launch the game it zeroes out the X and Y Size values.  It also puts a -0.05 in the X Center Value and 0.05 in the Y Center Value.  In the sprite collections for both objects I'm setting their Collider Type to Box Trimmed.

I'm also using Playmaker to move the sprite around the world and play the animations on the animated sprite, which seems to work fine. 

Any ideas?

Thanks. 


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: problem with collision between sprite and animated sprite
« Reply #1 on: April 16, 2013, 03:30:24 pm »
How are you moving the sprite in playmaker? If you're moving the sprite, then you must have a rigidbody on it.

If the box collider zeroes out, it means it isn't set up correctly in the sprite collection editor. Set that up correctly (set it to user defined if you want to manually configure it) and this should just work. Did you edit it in the Unity scene view / inspector after creating it?

sturmburg

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: problem with collision between sprite and animated sprite
« Reply #2 on: April 16, 2013, 04:39:24 pm »
Hi,

I was using Translate to move the sprite around, but then I switched it to use Controller Move and then added a Character Controller to the animated sprite.  I generated the collider for the animated sprite manually and it all works fine now.

Thanks for the quick response.