I am trying to check if there is a way to ignore collisions on an object completely. The object however will still have its rigidbody, but will not collide with anything. I know that Physics.IgnoreCollision
is the way to do it but looks like I have to provide colliders from each object. What is the right way to do this?
Physics.IgnoreCollision(null, GetComponent<BoxCollider>());
How about simply turning of its collider component?
GetComponent<Collider>().enabled = false;
Another alternative would be to configure a dedicated Layer , configure it in the Physics Settings -> Layer Collision Matrix to not collide with anything and temporarily assign that layer to your object
gameObject.layer = xy;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.