0

Is it possible to stop two objects/colliders/rigid bodies from exterting force on each other while still checking for collisions between them?

I know you can do that by checking 'Is Trigger' property on the Collider2D component but if I do that the object will no longer stand on the platform and falls down.

I know you can use Physics.IgnoreCollision but the problem is I do want the collision to take place and I'm checking it through OnTriggerEnter method. I just want to objects to stop exerting force on each other like dragging other with it.

Think of it as a classic arcade platformer games where enemies can kill player by colliding with it however passes through it. Or for a short period of time make it invincible at the start of the game.

Dashing Boy
  • 477
  • 2
  • 10
  • 21

1 Answers1

2

Check the isKinematic tick.

You can then control your object via transform and still detect collision without bouncing or force.

For the invincibility case, where the player is not affected (and often half transparent), you could disable the collider.

Everts
  • 10,408
  • 2
  • 34
  • 45
  • But isn't if I check isKinematic, I will no longer be able to to use the Rigid Body physics and for all the jumping, gravity related coding needs to be done by me? Right now, I'm using Rigid Body to control the jumping behavior and such that. Secondly, I can't disable the collider or else the object will fall down from the platform (and screen) and continue to do so because of lack of any collider. – Dashing Boy Feb 14 '16 at 09:53