Hello!
I needed hanging custom movement mode for my game and probably need some more movement modes, so I created a new movement component which inherits from
UCharacterMovementComponent.
I set up my custom movement component using ObjectInitalizer which is shown on the next line:
AGameCharacter::AGameCharacter(const FObjectInitializer& ObjectInitializer) :
Super(ObjectInitializer.SetDefaultSubobjectClass<UGameCharacterMovementComponent>(ACharacter::CharacterMovementComponentName))
{
…
}
For next, I had SetMovementMode function and PhysCustom function both overridden. In SetMovementMode function I can do the setup for my hanging custom movement mode as shown in the following line:
void UGameCharacterMovementComponent::SetMovementMode(EMovementMode NewMovementMode, uint8 NewCustomMode)
{
Super::SetMovementMode(NewMovementMode, NewCustomMode);
if (NewMovementMode == EMovementMode::MOVE_Custom && NewCustomMode == (uint8)ECustomMovementModes::MOVE_Hang)
{
//TODO
}
}
And I am not aware what PhysCustom function is for, many threads suggested overriding it.
However, the problem is - whenever I change my movement mode to custom movement mode such as hanging and in my jump function for example I want to change the movement mode to falling, the movement mode won’t update itself anymore and it will stay in Falling movement mode.
When I print out movement mode continously and jump afterwards it will change between Falling and Walking, but the character will always stay on ground.
I am not sure what I should do to overcome this problem as I can’t find much information on the internet.
Looking forward to your reply,
With regards
EDIT: Even when switching between non-custom movement modes, the movement modes won’t change properly. I believe the problem is somewhere in the new custom movement component.