Announcement

Collapse
No announcement yet.

Instead of overlap on timer

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Instead of overlap on timer

    Hi,

    I'm facing with issue how to use timer or other solution, like trigger box when is GetLocationActor.Size-500 = result.


    Now I have these code:

    void AEnemy::AgroSphereOnOverlapBegin(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
    {

    if (OtherActor)
    {
    AMyMain* Main = Cast<AMyMain>(OtherActor);

    if (Main)
    {
    MoveToTarget(Main);
    }
    }
    }




    void AEnemy::MoveToTarget(AMyMain* Target)
    {
    SetEnemyMovementStatus(EEnemyMovementStatus::EMS_MoveToTarget);

    if (AIController)
    {
    FAIMoveRequest MoveRequest;
    MoveRequest.SetGoalActor(Target);
    MoveRequest.SetAcceptanceRadius(25.0f);

    FNavPathSharedPtr NavPath;

    AIController->MoveTo(MoveRequest, &NavPath);

    UE_LOG(LogTemp, Warning, TEXT("Your mess32131age"));

    }

    }


    This code works but only on overlapbegin. This is not ok for me. How to use:
    AMyMain* Main = Cast<AMyMain>(OtherActor);

    if (Main)
    {
    MoveToTarget(Main);
    }



    code on timer,...

    Thanks



    #2
    Can you share more information regarding what you want to achieve ? Its not much clear.

    Comment

    Working...
    X