Is there another option of Trigger Volume actor?

Hi!

I’m learning Unreal developing an Arkanoid clone:

If I want to know when the ball goes bellow the paddle, what kind of actor do I have to use?

I think I can use a Trigger Volume, but I’m not sure because the Unreal documentation, Trigger Volume Actors in Unreal Engine | Unreal Engine 5.0 Documentation, say that I have to use the Level Blueprint. And I have read that it is not a good idea to use it.

Thanks!

I’m assuming the player ‘thing’ there is a blueprint? You can make the collision volume part of the blueprint. The player can move around, but the collision volume doesn’t.

Thanks!

The player ‘thing’ is a Blueprint Class. It’s the rectangle at the bottom of the image. The square is the ball.

I don’t know how to do your suggestion but it’s fine. Something new that I can learn.

Thanks a lot.

Ok, so you put the collision box in the BP with the player. Your code should only move the player around, and not the box. So don’t move the whole actor, just the ‘bat’. ( tell me if you need more ).

Thanks.

I think I’m going to move the static mesh inside the pawn (with Set Local Offset, I think). But I don’t know how to set the size of the collision box because I set this class as the default spawn in the Game Mode class, and it appears when the game start.

Right, but the player is always in the right place?

So as long as you set the width by default of the collision, it will also be in the right place.

You could also make it separate and part of the level, then you have to talk between the blueprints.

I don’t understand that. The player will only move the paddle to the left or to the right. I don’t understand which is the right place.

You’re spawning the player actor at the bottom of the screen, right?

So if the collision volume is in there also, it will automatically be in the right place.

1 Like

I was thinking about your solution and the BP_Paddle class already has a box collision, the Cube mesh has it.

How can I identify which box collision has been overlapped?

Thanks

Instead of using ‘begin overlap’, you can use ‘component begin overlap’.

But like I say, you can also have a separate BP for the bottom of the screen. Why not? :slight_smile:

1 Like

I’m not sure if I have understood everything correctly:

  • If I use a Trigger Volume actor, I have to handle the events in the Level Blueprint.

  • I can add another box collision to the pawn to handle when the ball passes the paddle.

  • Create an Actor BP class with a box collision to handle when the ball passes the paddle.

I have another question: If I don’t want to use Level Blueprint, where I can handle the events generated in a trigger volume actor?

Thanks a lot for your help.

Yes. So don’t do it :wink:

Yes.

Yes again.

You take action, or you can send a signal to the player, or… What is supposed to happen?

The player will lose one live, if he/she has one or more, and the ball will appear over the paddle and the game will continue.

Ok, so when the ball overlaps the BP actor, it can call a custom event in the player, ‘lose life’.

Do you get what I mean?

Yes, I get what you mean.

Or it could call a custom event in the game mode or game state (if I have to use them).

You could if you want to be really obtuse. Are you already using these? If not, you don’t need to just for this… :slight_smile:

OK. Longman dictionary said that the meaning of obtuse is: slow to understand things, in a way that is annoying. But I think it is slang.

Yes, I use both because I’m learning and now I don’t know what I am doing. I think both are used only in multiplayer games.

It doesn’t matter if single or multi

It also doesn’t matter if you do it the inefficient way cuz that’s the way we learn

Your Character, Ball and Level exist in a 3D Space

You can place a trigger box (or even a normal rendered box! It doesn’t matter) beneath the “bat”

You don’t need the Level Blueprint as you can trigger an action in many different ways, but Level Blueprint is okay too for a lil project like that

Remember - there’s nothing wrong about our creations! If those do not work as intended then it’s called art :slight_smile:

Anyway, here some steps for you as a homework:

Create a new Actor and call it “void” or “killah triggah”, what you just like

To the Actor add a Box Collision, place the Actor in the Level and rescale so it surely will always catch the Ball below the Bat

Now when you have the Box selected - scroll down its details to find Events - On Overlap Begin

Now from the Other Actor pull out and find “cast to YOUR BALL-BP NAME”

This cast will fail if any other Actor touches the trigger and it will skip doing the code

But if it’s successful - you wanna know about your hearts etc

If you are using a pawn - Get Player Pawn → Cast To YOUR PLAYER NAME

Or if you’re using a Player Controller - Get Player Controller → Cast to YOUR CUSTOM PLAYER CONTROLLER NAME HERE

You can think about the cast like a filter, it will go only if Object connected is correct AND it was in fact what you casted to, otherwise you can make exception code for “Cast Failed”

Once casted - you have FULL ACCESS (almost) to the BP - you can run functions that are there, get info about components, variables, change them etc

So summarising:

New Actor that will look for the Ball is necessary (not really as this can be done in many various ways)

Using it’s built in Events for Overlaps we check (with the Cast) what was the thing that passed through

Now as you’re sure it’s the ball - you have access to it! You can destroy it, replace, run game over or whatever you like

Also you can access your Player st any time with the simple cast I mentioned above:
Get Player Pawn → Cast to your Custom Player Pawn, that blue pin the Cast is holding has all info about the BP :slight_smile:

Hope this got a lil bit more clear :grin:

Also if you wish - here’s how to open doors on integrated Trigger, as well using a totally separated actor

There are obviously more and different methods for everything, for now you just have to learn about them :slight_smile:

Hmm, I thought it meant ‘obscure’.

No insult intended :wink:

2 Likes

I’ve red through the post and saw he’s new and kinda gets lost in between, my explanation isn’t better, just summarised a few things :wink:

Main thing he gets our point and some experience :grin:

Edit: And it was solved by your answer :laughing: