Announcement

Collapse
No announcement yet.

OnComponentBeginOverlap only works on the first Floor Tile

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

    OnComponentBeginOverlap only works on the first Floor Tile

    Hello, I have attached a collisionbox to an Actor and everytime my character is colliding with it i am creating a new floor tile but it only works on the first collisionbox. here is my code :

    PHP Code:
    void AFloor::BeginPlay()
    {
         
    Super::BeginPlay();  
         
    Collisionbox->OnComponentBeginOverlap.AddDynamic(this,&AFloor::CheckCollision);
    }  

    void AFloor::CheckCollision(UPrimitiveComponentOverlappedCompAActorOtherActorUPrimitiveComponentOtherCompint32 OtherBodyIndexbool bFromSweep, const FHitResultSweepResult)
    {
           if ((
    OtherActor != nullptr) && (OtherActor != this) )
           {
                
    SpawnFloor(); // here i spawn a Bluepring floor tile actor
            
    }

    I dont know why ot only triggers the CheckCollision event ont the first tile.
    Hope someone can help me out here
Working...
X