I have diagonal elevators. Basically, boxes that move and can carry the player. Up to a certain speed, they work fine. After some threshold, the player starts drifting across the elevator and eventually falls off the edge.
Working case, EV speed set to 100 units / second:
https://www.dropbox(.)com/scl/fi/4jrszmrjxtvv8pqe0u8il/Screencast-2024-06-08-22-27-55.mp4?rlkey=gynyjxgk5xl3ff11yqt9s0zzp&dl=0
Failing case, EV speed set to 105 units / second:
https://www.dropbox(.)com/scl/fi/wg47deojb8i45mzlra5n1/Screencast-2024-06-08-22-28-23.mp4?rlkey=d230ohu0pr1254sj90f0dj7j2&dl=0
(had to break links since forum wouldn’t work with the videos for whatever reason)
The code to move the elevators is simple:
FVector delta_move(10.0f, 0.f, 10.0f); // some given movement vector
// move EV
const FVector ev_current_location = GetActorLocation();
const FVector ev_final_location = ev_current_location + delta_move;
FHitResult sweep_hit_result;
SetActorLocation(ev_final_location, true, &sweep_hit_result, ETeleportType::None);
// if we hit Character, move it along
if (sweep_hit_result.bBlockingHit)
{
AActor *actor_ptr = sweep_hit_result.GetActor();
FHitResult pawn_sweep_hit_result;
actor_ptr->SetActorLocation(character->GetActorLocation() + delta_move, true, &pawn_sweep_hit_result, ETeleportType::None);
// process collisions....
// retry moving EV to its final location
SetActorLocation(ev_final_location, true, &sweep_hit_result, ETeleportType::None);
// process collisions....
}
So, what am I actually missing? Am I moving the actors incorrectly? I’m assuming that after some threshold, the actor is considered to be ungrounded and then it starts skidding? Or is there a better way to move the EV that will carry the character along?