From my experience, there is a couple ways to do this:
One way is to set the Rigidbody and the object you do not want the RigidBody to collide with on different masks/layers. I can never remember quite how the layer/mask system works, but I've found that putting the RigidBody on one layer and mask, and putting the other object on another layer and mask makes it where they do not collide with each other. The downside with this method (for me personally) is I have to play around with it until I get a mask/layer combination I like.
The other way you can do it is by making a collision exception in your RigidBody using add_collision_exception_with
. Then the RigidBody will not collide with the object passed in to add_collision_exception_with
. The big downside with this is you will have to add a collision exception for each object you want the RigidBody to avoid, which depending on how your project is setup, it may be very impractical if not impossible (for example, this does not really work with randomly generated material).
Hopefully this helps!