How to dynamically add a collision to a character?

Hi everybody,

I am currently working on a crate system that you can push around without rotating it. I managed to get a “grab/release” system by parenting the crate to the character, but when the crate is grabbed and moved, it can be pushed through walls. I would like the box to block the character when he pushes it toward a wall, preventing it to clip through.
I looked for a way to “combine” the bounding boxes, or adding another bounding box to the character to his current capsule, but I haven’t found anything yet.
Is there a way to do it in Blueprint? Am I approaching this problem correctly? If not, what would you suggest?

Thank you for your help!

Can you make a screenshot , it would be great to clearly understand your problem

Thank you, I will post a comment with screenshots right away.

Hi, here are screenshots of my problem :

The first screenshot shows what happens when the crate is grabbed by the player and pushed toward a wall : the crate clips through the wall (but not the character).

The second one shows the result of the character “releasing” the crate : it is pushed back into the level bounds.

I forgot to mention that the crate still has collision on its own since it can stop projectiles and push other crates when colliding while being grabbed.

What I would like is the grabbed crate to be blocked by the other collisions like walls, and prevent the character to push it through. That is why I want to add the crate collision to the character capsule.

If think the easiest way is to make another box collision shape which will be activated when the character carries a crate

just add this to your character code :

.h file :

/** Crate collision shape*/
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = boxComponent)
TSubobjectPtr<UBoxComponent> CrateBox;

.cpp file (in the constructor ) :

 CrateBox = PCIP.CreateDefaultSubobject<UBoxComponent>(this, TEXT("CrateBox"));

After this you just have to set up your box scale , and activate/deactivate it via your blueprints content

Thank you for your answer, but for the time being I need to work in full Blueprint. We currently are based on the “Blueprint Third Person” template and thus use the basic character. I haven’t found any *.cpp or *.h files in the project either, so I unfortunately cannot actually try your method…

On your blueprint just enter box and select it :

Thank you,

but I already tried this and it didn’t seem to work. More accurately, it DID have collisions with the other objects and generated overlap events, but it did not change the “solid collision” of the player, as if the capsule was the only thing that was blocked by the level bounds. I did check everything as ‘Block’ in the generated collisions.

However when switching to another character in the scene, that one DID collide and was pushed back by the one that had the new collision box. He could even walk on top of the box and be “carried around” by the other.

Is it possible that it could be a matter of priority of collision computation? Could I have missed some settings regarding that?

Can you take a screenshot of your collision options for both the box and the capsule ( blueprints details window )

Here is the capture of the capsule collision settings :

And the box settings :

I also tried to mimic the capsule settings for the box, but it doesn’t seem to have any effect.

Here is the current “in game” situation :

In short : the collision boxes collide with the other character’s capsule but not with the other box. It does not collide with the crate box either, but DOES generates overlap events.

PS : sorry, I really must take the habit to present screenshots… Thank you for your patience.