Download

Click to destroy mesh

Hi, so I want to click to destroy mesh and change to another level. I can’t remember how to do it. Please tell me how to make it, also the key to destroy is left mouse button.

It’s this:

Do read that tooltip to avoid hair pulling, though.

I tried, still not work. Idk why

  • include some details
  • attach a screenshot
  • which blueprint are doing it all in
  • what is firing what isn’t
  • put print string and see what works
  • what have you tried
  • any collision setup we need to know about

I could list things that’d make it stop working all day long. Helps us help you.

Here’s what I did, the purple down there is for loading to the next level. Idk why the target comes out

This blueprint is the actor, not the player. I tried on player but still, it doesn’t work. I haven’t try to use the collision box yet.

  1. You need to enable receive input on the actor. This can be done in the actor settings or using the node.
  2. You don’t need to cast to drink since you’re already in the actor itself.
  3. Since you’re destroying the root, use destroy actor instead, with a reference to self (which should be the default).

Things that stand out:

  • this is a basic actor, it should not handle input (input should be handled in the Pawn / Player Controller); this way the player can tell an actor to execute an action
  • for the above reason, the input is disabled in actors by default. It can be enabled in the Class Defaults → Auto Receive Input. Not recommended, though. You will need to deal with Input Consumption and Input Priority - can be a lot of hassle.
  • why are we destroying the root component? Why not simply destroy the actor? What purpose does it serve?
  • you did not read the note I suggested you read when I posted the original image. It’s irrelevant if you want to destroy the actor, though.

You originally said:

click to destroy mesh

So we’re not destroying the mesh?

Yeah, I would recommend destroying the actor from the player instead; the way it is now, every drink in the level will be checking for input.

1 Like

Perhaps this should be in the Player Controller. This way whatever you click on gets destroyed.

To filter things out (so you don’t destroy everything you touch!), instead of casting, you could add new object types in the Project Settings.

The above will detect only one specific object type which can be assigned per actor / class. Quite efficient.

I finally made it, thanks both of you guys.

1 Like