- Home /
How to disable collisions without disabling rigidbody?
When my enemies die I am applying torque to their rigid bodies so that they spin, but I want to then prevent the player from being able to collide with them. Anything I do seems to also disable the torque I am applying. I tried disabling the collider, which didn't work. I also tried setting the collider to be a trigger, and that didn't work. How would I make my rigidbody still move around with it's existing momentum, but just not be affected by anything colliding with it?
Answer by BobyStar · Sep 06, 2021 at 02:29 AM
In your code while the enemy spins:
Collider.enabled = false;
Rigidbody.velocity = Vector3.zero;
In your rigidbody settings in the inspector make sure that Angular Drag
is set to 0
so the enemy doesn't slow down when spinning.
You can also try disabling the rigidbody and use an Animation or Rotate the Transform for the spin.
Your answer
![](https://koobas.hobune.stream/wayback/20220613042629im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Rotate a 2D Rigidbody to a desired angle using AddTorque? 3 Answers
After AddTorque, the resulting angularVelocity depends of the RigidBody's velocity? 0 Answers
Different collision results in some areas. 1 Answer
Workarounds for Higher Control When Using Physics2D? 0 Answers
Torque stopped working after update 1 Answer