Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - KyleStaves

Pages: [1]
1
Support / Collider Unset - Safe to use?
« on: February 14, 2012, 08:28:32 pm »
Hello,

I have a couple of sprites that are significantly smaller than their trigger area - so I'm setting up the colliders myself the usual Unity way. However, at runtime they always set themselves to position 0,0,-100000 with 0,0,0 extends.

I looked through the source to find the area where this was happening and found it in sprite base.

Code: [Select]
else if (sprite.colliderType == tk2dSpriteDefinition.ColliderType.Unset)
{
// Don't do anything here, for backwards compatibility
}
else // in all cases, if the collider doesn't match is requested, null it out
{
if (boxCollider != null)
{
// move the box far far away, boxes with zero extents still collide
boxCollider.center = new Vector3(0, 0, -100000.0f);
boxCollider.extents = Vector3.zero;
}
}

I then set the collider type for the sprites in question to "Unset" and it fixed the issue. I'm just curious if this is the correct/safe way to handle this moving forward (as the code suggests it's legacy support and the conditional may be removed in the future) - or if there is a better way to handle this.

Thanks!

Pages: [1]