I have a custom player controller blueprint accepting input and working as intended. Is there a kind of event or something I should be creating that the possessed pawn can receive? I don’t want to hard-code any functionality into the controller or the custom pawn class - I should be able to possess different pawns, and have them behave differently to the same input, if I so desire, rather than hacking away at the controller on a case-by-case basis.
you would need to check a diagram and see who intercept input event first. if you are aiming to have no input event at all, then interface would be your answer. but make sure your interface function only have inputs and no output. then in your controller, you can get controlled pawn, check interface implemented, and call the event regardless of pawn’s class.
That interests me… that interface idea. I’ve read about interfaces, but how do they fit in with the pawns? You’re saying the interfaces are like the potential actions either the player or AI can have, and therefore any controllers should be able to execute those? (Kinda like C++ polymorphism?) How do I know that every pawn in my game has the exact same potential actions? A bird is different to a spaceship or a bicycle.
I’m having trouble connecting via the interface. I have the following in my BP_PlayerController blueprint, where the functions on the right are part of the BPI_ControlFlight interface:
Interface:
And then the BP_BaseShip (i.e. my pawn) blueprint:
That breakpoint never triggers… am I connecting this the right way?