- Home /
Problems With IgnoreCollision
I have a player object which 'inflates' when tapped, specifically the scale for x and z increases and then decreases. This inflation is used to bump a ball around a field. I have a sphere collider attached to the player object but unfortunately the sphere collider scales in all directions. This results in the player 'bumping' into the air. A mesh collider works but the performance hit on an iPad is too great when I add a bunch of players. I came up with the following solution but unfortunately it doesn't work as planned.
If I put the following code before the scale increase
Physics.IgnoreCollision(Field.collider, collider, true);
rigidbody.useGravity = false;
and this code after the scale increase
Physics.IgnoreCollision(Field.collider, collider, false);
rigidbody.useGravity = true;
I don't get the player bump but the ball doesn't inherit the momentum of the bump. It merely gets pushed out of the way and then returns to its previous speed.
Any suggestions on how to fix this?