after following some tutorials, I was able to create a custom character movement controller, a custom movement mode , and a custom physics script.
The issue is that after successfully enabling the custom movement move as confirmed by this test
if (MovementComponent->MovementMode == CMOVE_Skater && count > 100) {
UE_LOG(LogTemp, Warning, TEXT("movementModeSet"));
count = 0;}
else {
count ++;}
The attached physics script does not run.
the movement mode is attached this way:
void UCustomMoveComponent::PhysCustom(float deltaTime, int32 Iterations)
{
Super::PhysCustom(deltaTime, Iterations);
switch (CustomMovementMode) {
case CMOVE_Skater:
PhysSkate(deltaTime, Iterations);
break;
default:
UE_LOG(LogTemp, Fatal, TEXT("InvalidMovementMode"))
}
}
The physics script is defined this way:
void UCustomMoveComponent::PhysSkate(float deltaTime, int32 iterations)
{
UE_LOG(LogTemp, Warning, TEXT("Skate Physics Started"));
if (deltaTime < MIN_TICK_TIME){
return;}
iterations++;
bJustTeleported = false;
Velocity += skateGravity * FVector::DownVector * deltaTime;
FVector AdjustedPos = Velocity * deltaTime;
FHitResult Hit(1.f);
FVector ForwardVec (1,0,0);
FQuat NewRotation = ForwardVec.Rotation().Quaternion();
SafeMoveUpdatedComponent(AdjustedPos, NewRotation, true, Hit);
UE_LOG(LogTemp, Warning, TEXT("Skate Physics ran"));
}
the lack of “Skate Physics (ran ||started)” confirms that it is not running regardless of the actual contents of the function
My guess is that there is a link between activating the movement mode and actually using it that i am missing.
Any advice appreciated