How to force my character to unground?

I have a piston in my map with configurable speed. I have found a threshold (2750 units / second) in which a character on top of it behaves differently:

  • below 2750 the character is “stuck” to the piston, so the character moves up and down without being thrown up
  • above 2750 the character is thrown by the piston upwards

How am I moving them? I have here the Piston Actor movement code, but essentially I move the piston. If it would collide with the player, I move the player for the same delta, and then try to move the piston again.

	FHitResult sweep_hit_result;
	const FVector final_location = GetActorLocation() + delta_move;
	SetActorLocation(final_location, true, &sweep_hit_result, ETeleportType::None);

	// if we hit Character, move it along (collisions set up such that we only collide with player)
	if (sweep_hit_result.bBlockingHit)
	{
		// move actor out of the way
		AActor *player_ptr = sweep_hit_result.GetActor();
		FHitResult pawn_sweep_hit_result;
		player_ptr->SetActorLocation(player_ptr->GetActorLocation() + delta_move, false, &pawn_sweep_hit_result, ETeleportType::None);

		// TP to intended location
		SetActorLocation(final_location, true, &sweep_hit_result, ETeleportType::None);
	}

I wanted the character to be thrown up even with lesser speeds, but I think something is forcing the character to be grounded to avoid some jitter or something (in Unity, the controller called this a “grounded” phase and we could trigger a “force unground” call to calculate upward forces properly without the character jittering against the floor). I’m not sure what this would even be called in Unreal, so not sure what to look for. I’m basically using the FPS example character, with little else changed.

Stuff I’ve tried:

  • setting the character’s capsule collider root component to enable physics, character stopped moving at all
  • fiddling with jump triggering without much success
  • changing movement and teleport options in piston and character

I think this is probably something similar, some method I can call in cpp to unclamp the character from the ground, but no idea where to look for it.

I did find a way to sort-of fix this, using AddImpulse. I’m not sure if it’s the best solution, since it make the movement kinda jittery, but it seems to work for now. Will reply if I find a better solution

		AChronoCharacter *Character = Cast<AChronoCharacter>(player_ptr);
		Cast<UCharacterMovementComponent>(Character->GetMovementComponent())->AddImpulse(delta_move * 10, true);