Should I create a new MovementMode for stunning a character?
My question is two parts: Should I use a custom MovementMode called "Stunned" for example if I want to make a character unable to move (set its max speed to 0)? And if so, how do I create a custom movement mode?
asked Feb 08 '15 at 10:40 PM in Blueprint Scripting
Creating a custom MovementComponent will help you refine your implementation, I use a custom one for a 2D/3D point'n click adventure game to handle rotation a bit different, so yes using a movement component will help you. The bad thing is that you have to study carefully how the base MovementComponents is build to be able to adapt it to your needs.
C++ work (if you want to got that route)
The task to add you own MovementComponent will require creating a new C++ class that inherits from say UCharacterMovementComponent and a special class for you character that inherits from ACharater. You need a new base C++ class for you pawn to be able to override the existing MovementComponent of ACharacter. The following code is an base example on how you classes should look like:
Once you have a working MovementComponent we have to tell our character to use it:
With this steps you will be able to control the movement of your character the best way. On how you implement the stun logic and at the end any state related handling is totally up to you.
What about Blueprint?
If you would like to only block the player movement or input from BluePrint you can 'Set Ignore Movement Input' and 'Set Ignore Look Input' from your PlayerController.
Hope I could help you out!
Follow this question
Once you sign in you will be able to subscribe for any updates here