Download

Temporarily disable collision

Hello,

I’d like know how to make a blueprint script, were when the main character gets hit/damaged (that’s already in the script btw) the collisions are temporarily disabled. I’m making a 2D platformer, and I want the main character not to continuesly get hit by moving enemies.

So I was thinking too temporarily disable collisions so that the enemies continue walking without hitting the main character.

Use the node “set collision enable” you have three options, one is not collision.

Hello there!

There is a blueprint node named “Set Actor Enable Collision” that will allow you to enable/disable the collision for any actor.

Just right click in the graph and type collision, it should be visible in the list then. :slight_smile:

EDIT: The difference between this node and the “Set Collision Enabled” node is:

  • “Set Actor Enable Collision” is called on an actor component (such as a pawn, rock, etc). It also allows you to toggle on/off.
  • “Set Collision Enabled” is called on a “PrimitiveComponent”, or in other words a component contained within the actor. Allows you to choose between no collision, no physics collision, and collision enabled.

Hello,

first of all, thank you for the replies!

I’m looking into " set collision enabled" and “set actor enable collision”. What is the best way to make my blueprint like this work:

28c8c6d101f6bdd0ddc4d8c3ee35a7c413fd6492.png

I just want, that when the actor takes “any” damage, the actor’s collision is disabled for 3-5 seconds. Basically making him invulnerable for that short period of time.

I’ve tried and failed, but maybe I’m looking at the wrong way to do it.

disable collision is not a good way to handle invulnerable, projectile will fly through your actor.
just setup a boolean called bInvulnerableMode and don’t actually do damage if this is true.
you can set it to true at the end of taking damage and put a timer delegate to set it back to false.
(and you can spawn/trigger some effects if it’s invulnerable and getting hit.)

Solution found

Hello,

for everyone who helped me, my gratitude!

I solved the problem.

For anyone in the same situation:

735f9da249f3bce3d8eb82393ab0964cfaac711a.png

The disable collision werks perfectly for the enemy actor. As it is a matinee moving him from position to position, he wil continue moving, but only hurt the main character once, without being an obstacle.

Does anyone know if you can disable collision of the capsule for certain animations?