Pinch to Zoom

Hello All,

I’m currently writing a pinch to zoom method within the InputTouch of player controller. I currently have:

    //Within BeginPlay
    ATouchPawn* Pawn = Cast<ATouchPawn>(this->GetPawn());
    BoomArm = Pawn->BoomArm;
    Boom_InitLength = BoomArm->TargetArmLength;
    Boom_LastLength = BoomArm->TargetArmLength;
    //Within InputTouch on moved
    if (Handle == ETouchIndex::Touch1) {
        Touch1Loc = TouchLocation;
    if (Handle == ETouchIndex::Touch2 && !T3D)
        Touch2Loc = TouchLocation;
        T2D = true;
        FMath::Clamp(BoomArm->TargetArmLength, -50.0f, 1000.0f);
        VecLength = FVector2D::Distance(Touch1Loc, Touch2Loc);
        BoomArm->TargetArmLength = Boom_LastLength - (VecLength * -1);
    //Within TouchInput on touch end
    if (Handle == ETouchIndex::Touch2 && !T3D)
        T2D = false;
        Boom_LastLength = BoomArm->TargetArmLength;

The problem I’m encountering is that when the touch is made, its detected as a move, and the distance between the fingers is calculated setting the boom arm outwards without actually moving your fingers.

I’m not sure how to better write it to prevent this problem in the future.

Any help is appreciated.

Thank you.

By touch, you mean two fingers on the screen?