Disable object collision when put then enable it

Hi,

I am coding a Bomberman Like game in C++ with Unreal Engine and I’m facing a problem :

When the player put a bomb, he’s stuck in it. I would like to disable the collision so my player can move, but if he try to go back at the bomb position he can’t because of the bomb collisions.

Thanks

There are two possible ways.

1 - You disable collision by using SetActorEnableCollision(false) on the bomb actor to make the bomb not collide anymore.

2 - You change the collision profile by using SetCollisionProfileName(TEXT(“OverlapAll”)) on your bombs mesh.

I would go with (2) because then your bomb will not collide, but still give you overlap information about the player that is on top of it. As soon as the player leaves and there is no overlap anymore, I would change the collision profile back again so that the bomb starts colliding again.

Thanks for your answer, how can I know when the player don’t overlap the bomb anymore ?

You can use the OnActorEndOverlap event on your bomb to change the collision profile from one that just overlaps to one that actually colides with actors.

Detailed information on collision profiles: