Hello Guest

Author Topic: Collider type box custom problem?  (Read 5298 times)

Tongie

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 23
    • View Profile
Collider type box custom problem?
« on: September 25, 2012, 05:23:08 pm »
for spritecollection I selected
Anchor : Middle center
Coliider Type : box custom
Max X :1000
MaxY :2000

but the sprite is always at the upperLeft(Top left corner of the collider) how do I put the sprite in the centre of the collider? I change the center x and y in box collider but it always change back to the original.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Collider type box custom problem?
« Reply #1 on: September 25, 2012, 11:25:15 pm »
So are you trying to create a collider which is much bigger than the sprite? The collider is only allowed to be as big as the sprite itself. You could make your sprite bigger with more empty space in it - this will get trimmed out so theres no loss really.

Tongie

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Collider type box custom problem?
« Reply #2 on: September 26, 2012, 04:12:03 am »
ya but the collider can be created but the sprite is always at the top left corner. I want it to be at the center of the collider this the picture shown below. Anyway to do it?
« Last Edit: September 26, 2012, 04:13:45 am by Tongie »

dotty

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 65
    • View Profile
Re: Collider type box custom problem?
« Reply #3 on: September 26, 2012, 04:31:20 pm »
You'll need to pad out the image, add a transparent border. If the image is only 40x40, and the collider is 80x80, it's always going to display the image as 40x40. Make the canvas of the image the same as the collider size, that'll fix the issue. There might be a feature to add padding to the image by default, not sure ain't on a computer with TK2D installed.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Collider type box custom problem?
« Reply #4 on: September 26, 2012, 05:06:46 pm »
If its just ONE sprite, then you could just set collider type to Unset, and build it yourself in the Unity interface. The nice thing is that this is all flexible, you have a lot of options on how to go about it.