Download

Top down template and spawned meshes

Hi all,

Am in the process or learning how to use Unreal Engine, very much at the newbie stage.

Hopefully this is the correct forum.

For a personal project I am trying to write a random dungeon generator using the top down template. I have got to the position where a basic dungeon is being spawned on play (it has very basic rooms and corridors), however the spawned meshes do not seem to be “clickable”. I say this because the default level provided by the template is navigable by mouse click whereas the spawned meshes are not. I added some logs to the C++ player controller…



void AMyPlayerController::MoveToMouseCursor()
{
if (UHeadMountedDisplayFunctionLibrary::IsHeadMountedDisplayEnabled())
{
  if (AMyCharacter* MyPawn = Cast<AMyCharacter>(GetPawn()))
  {
   if (MyPawn->GetCursorToWorld())
   {
    UAIBlueprintHelperLibrary::SimpleMoveToLocation(this, MyPawn->GetCursorToWorld()->GetComponentLocation());
   }
  }
}
else
{
  // Trace to see what is under the mouse cursor
  FHitResult Hit;
  if (false == GetHitResultUnderCursor(ECC_Visibility, false, Hit))
  {
   UE_LOG(LogTemp, Warning, L"CODE: No hit result under cursor")
  }

  if (Hit.bBlockingHit)
  {
   // We hit something, move there
   SetNewMoveDestination(Hit.ImpactPoint);
   UE_LOG(LogTemp, Warning, L"CODE: Got a hit result, moving...")
  }
}
}


During play, I see only messages for the true bBlockingHit case. I think this is telling me that the spawned meshes have collision and can “be walked on” yes the pawn does not move. The pawn will only move onto meshes that have been added to the world using the editor.

The meshes being spawned are in a blueprint and have been scaled and transformed as they are spawned. Is the scaling the issue ? Should a room or corridor be made up individual tiles rather than a single scaled tile ?

Thanks, Chris.