Ignore collision between specific actors

In Unity3D, there’s a Physics.IgnoreCollision function that (unlike UE PrimitiveComponent::MoveIgnoreActors) not only suppresses collision events but also prevents actors from affecting each other when simulating physics.

Common use of this feature is prevention of physical interaction between projectile (for example, a grenade) with its instigator.

Since both Unity3D and UE use PhysX for physics movements, I’m assuming UE should also be capable of this feature, though I failed to find it.

The question is: how to achieve Physics.IgnoreCollision functionality in UE?

Please, don’t suggest using collision layers, it simply doesn’t work. In multiplayer game, each player is supposed to ignore only their own projectiles.

1 Like

This would be interesting to know.

There are other situations where disabling a pair explicitly without having to add a new collision-group is better:

Collision Npc<->Interaction Object.

Collision Weapon<->Projectile.

Collision Equipped Item ↔ Owner.

If you have access to the NxActor objects and the NxPhysicsScene, you can disable a collision pair with:

gScene->setActorPairFlags(*actor1, *actor2, NX_IGNORE_PAIR);

Is it possible to get the native pointers until this method is exposed eventually to the api ?

So I was looking for this same effect, and I found Ignore Actor When Moving. I personally set my system up in Blueprint, but I believe the C++ equivalent is MoveIgnoreActorAdd, for Pawns, at least.

This is what mine looks like. A few wires are crossed, but hopefully you should be able to get the gist of what is going on.

In my example, I just wanted to have 2 spheres attached to my character’s hand slots stop interfering with movement on the default character, but I still wanted to have them impact other physics objects so the character could punch things around with physics.

The top row has my Pawn’s CapsuleComponent being sent to the “Target” pin, while a reference to my base Punching Actor was sent to the “Actor” pin.

The second row has the same thing happen, but now my Pawn’s Mesh component is being sent to the “Target” pin. I’m not sure this is strictly necessary, but I didn’t want to screw up any IK stuff.

The third row has the sphere colliders owned by my Punching Blueprint being sent to the “Target” pin, while a reference to my Pawn was being sent to the “Actor” pin.

Do make sure that “Should Ignore” is checked for each one of these – it’s not checked by default, and I was wondering why it didn’t seem to have any effect. I was about to abandon this as a solution when I noticed that it wasn’t checked – checking it gave me my desired functionality. I imagine if you wanted to re-enable collisions between a PrimitiveComponent and an Actor you could do this again with them unchecked, or simply call ClearMoveIgnoreActors.

I’m not sure if this will also disable OnHit or OnOverlap events, but the answer provided here seems to imply that it does.

2 Likes

To disable collision between indicated physical body pairs you need to create your own ContactModifyCallbackFactory derived from IContactModifyCallbackFactory and then ContactModifyCallback derived from FContactModifyCallback.

Or just use my plugin

3 Likes

In addition to IgnoreActorWhenMoving there is also IgnoreComponentWhenMoving if anyone is looking for interaction between components in BT.

3 Likes