What is wrong with this blueprint? Destroy actor

So I am completely new to Unreal 4 but not to programming. I am playing around. I am using a ‘rolling ball’ template for my game. Basically I have a cube (stretched out so more like a plane); when I touch the cube with my sphere (which the player controls) I want something to be destroyed ( I don’t care what I just want the basics; here I am just destroying ANOTHER SPHERE (not the one the player controls) in the level). Why wouldn’t this blueprint work?

P.S. nothing happens.

You can’t cast a Actor to a playerController, your cast fails. You will have to get the actors controller and cast that to playercontroler. Because playerController does not inherit from AActor


Thanks for the answer. I have some questions if you have the time: what exactly is a cast? At the moment I am interpreting it as something that makes sure the collision only counts if the thing that hits the cube is the thing I cast to. Also, does the actor have a controller? I thought only pawns had controllers.

Yes only pawns have controllers, but pawns inherit from actor. So a instance of a class deriving from actor cán have a controller.

A cast is very complicated, so I am trying to keep it simple here.

A cast tries to get a more basic class of the object you are passing it, for example a Actor inherits from UObject, so you could cast a a Actor to a UObject, so you have more basic methods, and members.

This can only work ‘up’ (to a more basic version), ‘down’ (to a more complex version) doesn’t work. A cast returns NULL if it fails, the cast node has that a part that checks if it is not NULL and then executes the corresponding branch.

This way you can use a cast to check if a object derrives from a class thus make sure it is of a certain type.

A cast also can’t work if the two classes aren’t related in a way. In example actor to playercontroller. You could however cast actor->controller to playerController.

I hope this still makes sense for you.


Easiest way to fix it for you is to cast the other actor to the character class of your player (asuming it has one)

Thanks for the help, I guess I’ll just watch more youtube vids :slight_smile:

another way you could go it also is to have: get player character → == → branch. those three nodes in a row would do nearly the same thing as a cast except it would trigger your script when any character controlled by the player entered the trigger volume.

casting isnt all that hard at its most basic casting is just comparing two things to see if they are alike. for instance if you have a ford mustang and cast to car then it would succeed since its a type of car. if you tried to cast a mustang to plane it would fail since they are not alike. its all about hierarchy mustang can be cast to car since it has 4 wheels an engine and the basic functionality is the same. car however cannot be cast to mustang since it is more specialized (not all cars are fords, not all cars are sports cars, etc). all mustangs are cars but not all cars are mustangs.