Brick Breaker game only occasionally breaks bricks

I am new to unreal engine and have been trying to recreate a brick breaker game from a YouTube tutorial on c++ in unreal engine (I know I probably should’ve sought a different platform to learn this skill). Sadly, the ball will only occasionally break the bricks, with the majority of time it simply bounces off of the brick. I have tried different combinations of changing the collision presets of both the ball and brick, changing the object types, and even enabled and disabled the physics (thought it might work) but all with no success. The instructor, who challenged us with finding a solution to this issue, mentioned that it is a problem with the physics collision but did not give any more information. Can anyone help me find a solution since I am stumped? Thanks in advance and please let me know if you need me to provide any additional information or screenshots.

Is block and ball block eachother and oyu use hit event?

Hit events only fire on blocking collisions as far as I know.
Blocking collisions only occur between two actors when actor A is set to type X and is blocking channel Y, AND when actor B is set to type Y and is blocking channel X. Otherwise the most you’ll get is an Overlap event (which you can also use in this situation but it will not automatically bounce things away).
That being said, X and Y can be the same channel if you want, and I think for a simple brick breaking game, that might be just fine, perhaps WorldDynamic.

I do not think Physics Simulation is required to get a Hit event.

These collision type/channel settings might have to be set on the root components of the actors. I’m still finding out about that.

The colliding meshes must have simple collision primitives set up on their static mesh asset in order to have anything to collide with. The visible 3-D mesh is not enough.

If you are moving the ball via SetActorLocation or AddRelativeTransform or similar, then it may be a good idea to turn on the Sweep checkbox on that node to make sure it doesn’t pass through the brick when moving quickly.

Are you using ProjectileMovement component? If so, what are your settings on that?

Those are all the things I would check on.

Here are my screenshots for the brick and ball. I set the brick to WorldDynamic and the ball to PhysicsActor. What should I set my collision presets to?

[link text][1]

316881-givename-unreal-editor-2020-09-30-04-22-46-trim-tr.gif

I am using a ProjectileMovement coomponent (attached below)

alt text

link text

If the ball bounces, then it’s clear that collisions are detected. So, the problem can’t be there. Maybe something is preventing its destruction.

Put some logs both in the Overlap event and in the Destroy brick.

I see your problem right away now with those PDFs you provided (thank you).

Hit events only occur on blocking collision.
Blocking collision only occurs between two objects when they both have their collisions settings set to Block each other’s Object Type

You currently have your Brick set to Overlap every object type (you can see this in those columns of checkboxes labeled Ignore, Overlap, and Block), so there is nothing in the entire universe that will cause a Blocking collision for Bricks, and therefore there is nothing in the universe that will trigger a Hit event upon touching a Brick.

The simplest way to fix this: You must set the Brick to Block the ball’s Object type (which is PhysicsBody), rather than Overlap it.
You don’t need to change the Ball, because it is already set to Block the brick’s Object Type (which is WorldDynamic).
So then they should both block each other.

Remember, if component A blocks component B’s object type, but component B only Overlaps component A’s object type, then it is an Overlap, not a blocking collision, and will fire an overlap event and not a Hit event.

If you want to, you could check for an Overlap event instead but that might get a little more complicated in this particular use case. Also remember that if an object Hits, it will not likely fire an overlap event since a blocking collision stops or bounces the object and prevents entry into the overlap.

The Unreal documentation probably explains this more thoroughly and more easily understood:

I tried changing the collision preset to BlockAllDynamic which immediately blocked all categories, however it still only bounces off of the brick. I also tried selecting Custom and only blocking the PhysicsBody, however it, too, only leads to mere bouncing off instead of breaking.

To quote from the link I sent you,

“Blocking will naturally occur between two (or more) Actors set to Block. However, Simulation Generates Hit Events needs to be enabled to execute Event Hit, which is used in Blueprints, Destructible Actors, Triggers, etc…”

In your PDF it shows that neither the ball blueprint nor the brick blueprint has Simulate Generates Hit Events checkbox turned on. Let me know if checking that checkbox causes the Hit event to fire now that your collision channels and types are set up properly.

So I made sure to select the Simulation Generates Hit Events checkbox, however, the ball still only bounces off without breaking the box (Now, I don’t know why, but now none of the boxes are breaking instead of the occasional broken box that I would get before). Is there something that I need to do outside of setting the right collision presets?

Simulation Generates Hit Events” in the brick. Did you implement the Hit event in the brick.

Make sure the blueprint you enabled Simulation Generates Hit Events is the one where you handle the Hit Event. Also, the first thing you should have the Hit Event do, is run a PrintString node so you can find out whether the Hit is not happening, or if it IS happening but not causing the effect you wanted.

Also, are the bricks set up as destructible meshes? If so, they might handle hits differently than what we’re prescribing.