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.
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.
EDIT: The difference between 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.
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 work:
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 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 if it’s invulnerable and getting hit.)
for everyone who helped me, my gratitude!
I solved the problem.
For anyone in the same situation:
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?