I've been struggling to properly affect the control of my player character. While basic options like MaxWalkingSpeed and AirControl are simple enough to customize, I still can't get the feel I want. What I'd like to do is extend some of the movement modes like MOVE_Walking and MOVE_Flying so that I can stop the slidy movement of flying and make ground movement more precise. Specifically, I really want to make the Flying movement have tighter turns, it drifts when I take turns, and I want it to turn on a dime. I understand that I could achieve some of this by altering Max and Min Walk Speed, but am I wrong to think it would be more efficient to set up custom templates for these properties?
I've looked at some of Unreal's tutorials and wikis as to how to create a custom CharacterMovementComponent, but I had a couple specific questions that I couldn't answer.
First, how does the EMovementMode enum work? Does MOVE_Walking work like a struct and contain the properties like MaxWalkingSpeed, Friction, Gravity, etc? Or are they simple indexes that CharacterMovementComponent reads and then applies the proper movement based on that?
Second, I specifically want to make a movement mode similar to MOVE_Flying that doesn't have the inertia that the default mode has. Should I simply change some properties either in my character class or a new enum like I talked about above? (I tried setting BrakingDecelerationFlying = MaxAcceleration, which helped but not as much as I'd like) Or should I create a new, custom CharacterMovementComponent that overrides PhysFlying()?
Thank you for your time and help.
Edit: I've done some more work since this finished posting. I now understand that the EMovementMode enum affects the StartNewPhysics function. (among others, but I believe this is the function I need for customizing the movement component) Related to that first point, I've also answered my second question, Following the examples I found here: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/20384-how-would-you-add-a-custom-movement-component-to-a-character and here: http:// https://wiki.unrealengine.com/index.php?title=Custom_Character_Movement_Component I created my own CharacterMovementComponent (UMyCharacterMovementComponent) and gave it a PhysCustom() funciton that overrides the original.
Now, if I understand correctly, I can use SetMovementMode(Move_Custom) to use this new PhysCustom() to apply the flying physics that I want to the player. Please, let me know if any of these assertions are inaccurate.
My new problem is I don't know how to call the SetMovementMode function from MyCharacterMovementComponent in my code. Would this work if I've only overridden Phys_Custom()? The methods explained in the links above are apparently out of date? I tried simply declaring
, then calling
but that caused a crash. Though, that may just as likely be the result of my rusty C++, I can only ask for your patience in that regard.
I hope I'm being clear enough. Thank you again.
Edit: I stopped the crashes, but the construction method I'm using doesn't work. How do I actually call my PhysCustom function that overrides the original, do I need to construct my UMyCharacterMovementComponent class? Or is there something else? This is the code I'm using at the moment:
The null check fails and the "Custom Movement Doesn't Exist" gets displayed. I apologize for all the edits, I'm just trying to do my part to resolve my issue.
I've looked at some of Unreal's tutorials and wikis as to how to create a custom CharacterMovementComponent, but I had a couple specific questions that I couldn't answer.
First, how does the EMovementMode enum work? Does MOVE_Walking work like a struct and contain the properties like MaxWalkingSpeed, Friction, Gravity, etc? Or are they simple indexes that CharacterMovementComponent reads and then applies the proper movement based on that?
Second, I specifically want to make a movement mode similar to MOVE_Flying that doesn't have the inertia that the default mode has. Should I simply change some properties either in my character class or a new enum like I talked about above? (I tried setting BrakingDecelerationFlying = MaxAcceleration, which helped but not as much as I'd like) Or should I create a new, custom CharacterMovementComponent that overrides PhysFlying()?
Thank you for your time and help.
Edit: I've done some more work since this finished posting. I now understand that the EMovementMode enum affects the StartNewPhysics function. (among others, but I believe this is the function I need for customizing the movement component) Related to that first point, I've also answered my second question, Following the examples I found here: https://forums.unrealengine.com/development-discussion/c-gameplay-programming/20384-how-would-you-add-a-custom-movement-component-to-a-character and here: http:// https://wiki.unrealengine.com/index.php?title=Custom_Character_Movement_Component I created my own CharacterMovementComponent (UMyCharacterMovementComponent) and gave it a PhysCustom() funciton that overrides the original.
Now, if I understand correctly, I can use SetMovementMode(Move_Custom) to use this new PhysCustom() to apply the flying physics that I want to the player. Please, let me know if any of these assertions are inaccurate.
My new problem is I don't know how to call the SetMovementMode function from MyCharacterMovementComponent in my code. Would this work if I've only overridden Phys_Custom()? The methods explained in the links above are apparently out of date? I tried simply declaring
Code:
UMyCharacterMovementComponent* CustomMovement = new UMyCharacterMovementComponent;
Code:
if (CustomMovement) { CustomMovement->SetMovementMode(MOVE_Custom); }
I hope I'm being clear enough. Thank you again.

Edit: I stopped the crashes, but the construction method I'm using doesn't work. How do I actually call my PhysCustom function that overrides the original, do I need to construct my UMyCharacterMovementComponent class? Or is there something else? This is the code I'm using at the moment:
Code:
UMyCharacterMovementComponent* CustomMovement = Cast<UMyCharacterMovementComponent>(GetMovementComponent()); //UMyCharacterMovementComponent* CustomMovement = new UMyCharacterMovementComponent; if (CustomMovement) { CustomMovement->SetMovementMode(MOVE_Custom); UE_LOG(LogClass, Log, TEXT("Custom Movement Exists.")); } else { UE_LOG(LogClass, Log, TEXT("Custom Movement Doesn't Exist.")); }