- Home /
Allow collision but take no force from it, not increasing object mass
I have a space worm enemy in my 2D shooter, it uses a rigidbody, joints and colliders. My rigidbody bullets explode and send a damage message when they collide with an object. I need to be able to ensure that the space worm can continue to move the way it does, while allowing it to get damaged by rigidbody bullets without its movement becoming impacted.
Is there a practical solution to this? Can I disable knockback? or should I try to take another approach to this?
$$anonymous$$aybe you could try to add the negative impact force into the OnCollision method which would negate the knockback effect? Never tried it out though!
Answer by tanoshimi · Nov 15, 2016 at 08:58 AM
It sounds like you want to set the rigidbody to kinematic and then listen for OnTriggerEnter rather than OnCollisionEnter.
Either that, or make the mass of your bullets so small relative to the mass of your worm that they don't transfer any significant force on impact.