Casting problem related to Player Controller

Well, I presume your BP_PlayerController does not have any collision and thus the overlap never fires for the player controller. Also, you are not handling input here in your graph, I recommend setting up EventDispatchers that handle the input coming into the character, then call the respective EventDispatchers inside the player controller (After the input action events), and anywhere else you might need them.

So recently I’ve been trying to move a bunch of scripting from my current player character’s blueprint to a new Player Controller blueprint I made after reading that using a Player Controller blueprint to handle inputs was recommended for handling multiple playable characters. It’s mostly gone well despite the fact that I’ve been winging it since I can’t seem to any tutorials on how to do properly, but the one area that’s been causing me problems is with the casting of my character’s actions to the test enemy I created.

how the enemy blueprint looked before I started transferring over to the Player Controller blueprint and everything worked perfectly:

But after revising the enemy’s blueprint after transferring most of my character’s actions over to the new blueprint, neither the jump collision setup or the baseball bat swing are working like they did before.

Of particular note is the fact that the baseball bat swing is affected. The reason that is important is because the baseball bat swing scripting hasn’t been touched during the transfer of scripting over to the Player Controller blueprint due to the fact that I intended to be a action unique to particular character. means whatever the source of problem is not a direct result of the aforementioned scripting transfer but rather a problem specifically with the casting within the enemy blueprint.

I’ve tried a number of things but nothing seems to work. Does anyone know why the casting isn’t working? Any help whatsoever would be greatly appreciated!

Thanks for the response, so I’m suppose to attach a collision capsule to the Player Controller? I’m not entirely sure how helps as the collision for the baseball bat and the jump collision is handled by their own collision boxes attached to my character and not the player’s collision capsule. At least I know the jump collision does, I’m not really sure about the baseball bat since I don’t see any references to the baseball’s collision box anywhere in my scripting, so maybe it doesn’t?

I could relocate the jump collision box to the Player Controller which would probably be ideal since it is a gameplay function that is intended to be shared amongst all of my playable characters and it would greatly simplify things if it the collision box for it was shared via the Player Controller. However, like I said in my original post, the baseball bat is a unique function of my current character and not the others, so the collision has to be handled by the character’s own blueprint which is suppose to actions unique to that particular character, as opposed to the Player Controller which is suppose to handle actions that are shared amongst everyone.

My concern though about using a single shared collision capsule for all my characters is that not all of my characters are the same size. Three of them are, but the other two differ quite a bit in size from the other three. Unless I’m failing to understand something, which is always a good possibility.

I’m also not sure what you mean the enemy blueprint not handling input? I don’t really handle technical jargon very well which is why I prefer to watch video tutorials or look at screenshots so I can decipher how things work visually, so I don’t really know what you mean by input into my test enemy and how Event Dispatchers would help.

It just occurred to me that my player character can still pickup items, the blueprints for the items cast to my current player character and not the Player Controller, although I guess it should just to simplify things since I intend more characters. I’m just not sure why the Player Controller’s lack of collision is interfering with my player character’s collision setup in the enemy blueprint, I mean the Jump Collision and the Baseball Bat collision boxes are both attached to my player character, and the baseball bat can still interact with the item pickups just not the test enemy anymore.

Oh… Well… Instead of “GetOwner” try using “GetPlayerController” for now. Tell me if works.

Yup, it worked. Both the functionality of the ump collision and the baseball bat swing have been restored. Thanks for the help!

Okay, I got a solution to the problem from a comment above. I simply had to change Get Owner to Get Player Controller and now collision has been restored to both the jump collision and the baseball bat swing.

Did you watch a tutorial that taught you to use “GetOwner”? If so, do you have a link?

Nope, it was done purely through trial-and-error.