Hello everyone, straight to the point; I’m simply trying to make a moving wall (and actually any object for future implementations) pushes the character naturally to whatever direction the wall (or any object) moves. However, the character; if not standing ON the object, does not follow the wall movement and does not ‘slide’ as expected, but stand still inside the wall (ignoring the moving collision of the wall ).
While I saw some old related questions to this, none seems to solve my problem. Timelines, matinee, move component to, any kind of movement I try on the moving wall, the character collision still ignoring it.
Staff, is this really working as intended?? If not, I really hope a fix to come soon, as it is a very recurrent need…
Hi, thanks for the response. I saw these questions but they’re all quite old,it’s been more than a year and yet pushing still not supported. There’s no updates on that matter?
I tried a constant Z force but didn’t worked for me. The character repositioning occurs in ‘jerky intervals’ just as you said.
I had the same problem, My problem was related with the door. I made a box component around the door (I guess you would do this for your wall) and surround it entirely. Then I made another box component that attaches to the opposite side of the door hinge at the bottom of the door (I guess this would be the center of your wall). Then I generated on overlap events for the first trigger box and in it I set the bool variable isTouchingPlayer to true and visa versa for on exit overlap event. In the tick function, I just push the player by the delta amount if the variable isTouchingPlayer is true.
// MyCharacter.cpp
// Pushes the player by a small delta amoount
void AMyCharacter::Pushed(FVector delta)
{
FVector NewLocation = GetActorLocation() + delta;
SetActorLocation(NewLocation);
}
// SingleDoor.cpp constructor
ASingleDoor::ASingleDoor()
{
SM_Door = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Door"));
DoorEdge = CreateDefaultSubobject<UBoxComponent>(TEXT("Door Edge"));
//Required for hack
DoorMeshTriggerBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Door Mesh Trigger Box"));
SM_Door->AttachToComponent(SM_DoorFrame, FAttachmentTransformRules::KeepRelativeTransform);
DoorMeshTriggerBox->bGenerateOverlapEvents = true;
DoorMeshTriggerBox->OnComponentBeginOverlap.AddDynamic(this, &ASingleDoor::BeginDoorCollision);
DoorMeshTriggerBox->OnComponentEndOverlap.AddDynamic(this, &ASingleDoor::EndDoorCollision);
DoorMeshTriggerBox->AttachToComponent(SM_Door, FAttachmentTransformRules::KeepRelativeTransform);
DoorEdge->AttachToComponent(SM_Door, FAttachmentTransformRules::KeepRelativeTransform);
//........
}
void ASingleDoor::DoorOpenTimeline(float val)
{
FVector DoorEdgeLocation;
FVector DoorEdgeDelta = FVector(0.0f, 0.0f, 0.0f);
FRotator DoorRotation = FRotator(0, val, 0);
DoorEdgeLocation = DoorEdge->GetComponentLocation();
SM_Door->SetRelativeRotation(DoorRotation);
// Push the player if the door is touching the player
if (GetIsDoorTouchingCharacter())
{
// Find by how much the player is to be moved
DoorEdgeDelta = DoorEdge->GetComponentLocation() - DoorEdgeLocation;
// Push the player by that amount
PlayerController->Pushed(DoorEdgeDelta);
}
// ....
}
I do not know how to do it without the door mesh trigger box, I’ve asked a question about it but have not got any reply