No announcement yet.

Character falling through the ground

  • Filter
  • Time
  • Show
Clear All
new posts

  • Character falling through the ground

    I want the Pawn possessed by PlayerController to fall down and stop on the ground like a tetris game, this is the function in the PlayerController:
    FVector PieceLocation = GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorLocation();
    FRotator PieceRotation = GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorRotation();
    FHitResult HitResult;
    PieceLocation.Z += Speed * GetWorld()->GetDeltaSeconds();
    GetWorld()->GetFirstPlayerController()->GetPawn()->SetActorLocation(PieceLocation, false);
    The piece falls down but it keeps falling even when it reaches the ground. I tried enabling bSweep and I also tried TeleportTo instead of SetActorLocation but nothing changes. I enabled collisions in the blueprint editor and I'm not using physics.
    How can I solve that?

  • #2
    It seems to me, that you continously add a movement direction (in your case: down) to your Piece. I think if it should collide with the Floor, then you have to stop the movement. I would do a triggerbox on the ground and then, if you hit it, stop the movement.
    01010100 01101000 01100101 00100000 01110100 01110010 01110101 01110100 01101000 00100000 01101001 01110011 00100000 01101111 01110101 01110100 00100000 01110100 01101000 01100101 01110010 01100101 00101110 00100000 01010100 01110010 01110101 01110011 01110100 00100000 01101110 01101111 00110001 00100001 00100000


    • #3
      Does the floor and your possesed pawn also have some collision on them? I'm not entirely sure, but a Pawn may need a collision as it's root to allow simulation of physics. They both need to be setup to block whatever the other type is.