![]() You want to keep things as logically separated or 'decoupled' as possible. I believe you shouldn't be handling the Pawn's movement in the Controller or disabling the movement from the HUD. ![]() The player's Character/Pawn class uses inputs to move,etc.Īnd when the menu is open, we completely disable input on the player Pawn. So how about this: The PlayerController handles opening menus, etc. ![]() the PlayerController gets first chance to handle an input otherwise it gets passed to the Pawn. In Unreal, input flows through a chain an object can "consume" an input otherwise it will fall through to the next in the chain. What's the correct way to handle this problem? W Key pressed, calling bound function to handle movement input, movement happens even if for the HUD it should still be disabled W Key pressed, calling bound function to handle movement input, no movement MyHUDInstance.m圜ontrollerPointer->DisableMovement() Some menu widget opened, pawn movement disabled Class MyHUD holds a pointer to the m圜ontrollerInstance Of course such a thing is going to happen because the HUD class will want to disable/enable the pawn movement everytime some widgets (such as an inventory screen) are opened/closed. Right now there is only one set of events that change bMovementEnabled (RMB pressed/released), but it's easy to see that adding something else that does the same thing will mean problems. Void M圜ontroller::MoveForward(float Scale) Inside the controller class, I have a boolean that I use to enable and disable movement. The controller will handle all movement and camera input functionality for the player. I'm working on a player controller implementation. I'm a 3D artist so sorry for any stupid coding error or any stupid question I make.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |