Collision Disabler

Author: Tomasz Klin
Version: 1.10.1

Introduction

This plugin lets you disable collisions between the pairs of physical objects that you specify.

Video: Collision Disabler

Unreal Engine has several methods to disable collisions between objects.

  1. Collision channels disable collisions between groups of objects, but not between specific objects.
  2. Ignore Actor When Moving tells a component to ignore collision with all components of a specific Actor while that component moves. But this does not apply to the physics simulation.
  3. Contact Modification changes the properties of the generated contact points. But to use it, you must know PhysX and C++.

Collision Disabler uses the last method. It gives you a very simple and easy way to disable collision between objects in the physics simulation.

Features:

Plugin Installation

To enable the plugin, do these steps:

  1. Open Edit -> Plugins.
  2. Select the Physics category.
  3. For Collision Disabler, select the Enabled check box.

Using in Blueprint

Disable Collision

Single Body vs Single Body

This node disables collision between two primitive components that each have one PhysicalBody, for example a StaticMesh. Pins:

Skeletal Mesh vs Single Body

This node lets you disable collisions between a SkeletalMeshComponent and a PrimitiveComponent. You must specify the bones in the SkeletalMeshComponent for which the node disables collisions. Pins:

Skeletal Mesh vs Skeletal Mesh

This node lets you disable collisions between two SkeletalMeshComponents. You must specify the bones in both components for which the node disables collisions.

Pins:

Re-enable Collision

For each "Disable Collision" node, the "Collision Disabler" plugin has a related node that enables collisions. These nodes let you enable collisions again between the specified components or types of components. Thus they reverse the action of the "Disable Collision" nodes. Their parameters and functions are similar to those of the "Disable Collision" nodes. But these nodes enable collisions, and do not disable them.

Single Body vs Single Body

Skeletal Mesh vs Single Body

Skeletal Mesh vs Skeletal Mesh

Is Collision Disabled

This node checks if a given pair of bodies has a disabled collision.

Gather All Physical Bones

This node gives you an easy way to list all the bones that have any physics representation.

Gather All Physical Bones From

This node returns a list of the physical bones that are below a given bone in the bone hierarchy.

Using in C++

It is easy to use the plugin in C++. All the functions above are in the UCollisionDisablerFunctionLibrary. Functions:

ReturnNameDescription
voidDisableCollision_SingleBodyVsSingleBody( UPrimitiveComponent* SingleBodyA, UPrimitiveComponent* SingleBodyB, float TimeToExpiration = -1)Disables collision between two primitive components that each have one PhysicalBody, for example a StaticMesh.
voidDisableCollision_SkeletalVsSingleBody( USkeletalMeshComponent* SkeletalMesh, const TArray<FName> SkeletalMeshBones, UPrimitiveComponent* SingleBody, float TimeToExpiration = -1)Disables collisions between a SkeletalMeshComponent and a PrimitiveComponent. You must specify the bones in the SkeletalMeshComponent for which the function disables collisions.
voidDisableCollision_SkeletalVsSkeletal( USkeletalMeshComponent* SkeletalMeshA, const TArray<FName> SkeletalMeshBonesA, USkeletalMeshComponent* SkeletalMeshB, const TArray<FName> SkeletalMeshBonesB, float TimeToExpiration = -1)Disables collisions between two SkeletalMeshComponents. You must specify the bones in both components for which the function disables collisions.
voidEnableCollision_SingleBodyVsSingleBody( UPrimitiveComponent* SingleBodyA, UPrimitiveComponent* SingleBodyB)Enables collision again between two primitive components that each have one PhysicalBody, for example a StaticMesh.
voidEnableCollision_SkeletalVsSingleBody( USkeletalMeshComponent* SkeletalMesh, const TArray<FName> SkeletalMeshBones, UPrimitiveComponent* SingleBody)Enables collisions again between a SkeletalMeshComponent and a PrimitiveComponent. You must specify the bones in the SkeletalMeshComponent for which the function enables collisions.
voidEnableCollision_SkeletalVsSkeletal( USkeletalMeshComponent* SkeletalMeshA, const TArray<FName> SkeletalMeshBonesA, USkeletalMeshComponent* SkeletalMeshB, const TArray<FName> SkeletalMeshBonesB)Enables collisions again between two SkeletalMeshComponents. You must specify the bones in both components for which the function enables collisions.
boolIsCollisionDisabled( UPrimitiveComponent* ComponentA, UPrimitiveComponent* ComponentB, FName BoneNameA = NAME_None, FName BoneNameB = NAME_None)Checks if a given pair of bodies has a disabled collision.
voidGatherAllPhysicalComponents( AActor* Actor, TArray<UPrimitiveComponent*>& OutComponents)Returns a list of all the components in a given actor that have a physics representation.
voidGatherAllPhysicalBones( USkeletalMeshComponent* SkeletalMesh, TArray<FName>& OutBones)Returns a list of all the bones that have any physics representation.
voidGatherAllPhysicalBonesFrom( USkeletalMeshComponent* SkeletalMesh, FName StartBone, bool bIncudeStartBone, TArray<FName>& OutBones)Returns a list of the physical bones that are below a given bone in the bone hierarchy.

Performance

Collision Disabler is very efficient. For objects that Collision Disabler does not manage, the performance cost is zero. For each collision with objects that have a disabled collision, the cost is very small and constant. Thus, only the number of objects that actually collide has an effect on performance.

Interaction Matrix

The table below shows if Collision Disabler can disable collisions.

Static Geometry - Geometry that cannot move, for example buildings and rocks.

Kinematic Body - Objects that can move, but that do not have physics enabled, for example characters and projectiles.

Dynamic Body - Objects that the physics engine simulates (Simulate Physics is enabled), for example ragdolls.

Body vs BodyStatic GeometryKinematic BodyDynamic Body
Static GeometryN/ANo1Yes
Kinematic BodyNo1No1Yes2
Dynamic BodyYesYes2Yes

1 - Kinematic and Static bodies do not generate collisions (Hit Events), because the physics engine does not simulate them. For some object classes, for example characters or projectiles, you can use IgnoreActorWhenMoving or IgnoreComponentWhenMoving so that the objects are not blocked.

2 - The plugin disables the physical collision, but kinematic objects can still be blocked. In this case, also use the IgnoreActorWhenMoving or IgnoreComponentWhenMoving nodes together with DisableCollision.