Beispiel #1
0
void VehiclePawnWrapper::displayCollisionEffect(FVector hit_location, const FHitResult& hit)
{
    if (collision_display_template != nullptr && Utils::isDefinitelyLessThan(hit.ImpactNormal.Z, 0.0f)) {
        UParticleSystemComponent* particles = UGameplayStatics::SpawnEmitterAtLocation(pawn_->GetWorld(), collision_display_template, hit_location);
        particles->SetWorldScale3D(FVector(0.1f, 0.1f, 0.1f));
    }
}
void AParticleList::BeginPlay()
{
	if (ParticleClass && AmountToSpawn > 0 && HasAuthority())
	{
		for (int32 i = 0; i < AmountToSpawn; ++i)
		{
			UActorComponent* comp = AddComponent(ParticleClass->GetFName(), false, FTransform(), this);
			UParticleSystemComponent* particle = NewObject<UParticleSystemComponent>(ParticleClass);//Cast<UParticleSystem>(comp);
			if (particle)
			{
				particle->AddToRoot();
				UParticleSystem* system = Cast<UParticleSystem>(particle);
				if (system)
				{
					particleList.Add(system);
					controllingActor.Add(this);
				}
			}
			UParticleSystemComponent* pComp = Cast<UParticleSystemComponent>(particle);
			if (pComp)
			{
				particleList.Empty();
			}
		}
	}

	SetActorLocation(FVector(0.0f, 0.0f, -999999999.9f));
}
void AShooterWeapon_Instant::SpawnTrailEffect(const FVector& EndPoint)
{
    if (TrailFX)
    {
        const FVector Origin = GetMuzzleLocation();

        UParticleSystemComponent* TrailPSC = UGameplayStatics::SpawnEmitterAtLocation(this, TrailFX, Origin);
        if (TrailPSC)
        {
            TrailPSC->SetVectorParameter(TrailTargetParam, EndPoint);
        }
    }
}
Beispiel #4
0
UParticleSystemComponent * ALightningStorm::Fire(ASwoim* first, ASwoim* second)
{
	if (LightiningParticle != NULL)
	{
		UWorld* const World = GetWorld();
		if (World)
		{
			//LightiningParticle->Get
			UParticleSystemComponent * FiredLightning = UGameplayStatics::SpawnEmitterAttached(LightiningParticle, first->GetMesh());
			FiredLightning->SetActorParameter("Target", second);
			return FiredLightning;
		}
	}
	return nullptr;
}
Beispiel #5
0
//Deactivate the Particle System Components
void AZanshinBasicArrow::DeactivateTrails()
{
	TArray<USceneComponent*> Childrens;
	GetRootComponent()->GetChildrenComponents(true, Childrens);
	if (Childrens.Num() != 0)
	{
		for (USceneComponent* Actor : Childrens)
		{
			UParticleSystemComponent* Particles = Cast<UParticleSystemComponent>(Actor);
			if (Particles != NULL)
			{
				Particles->Deactivate();
			}
		}
	}
}
void AHeatmapDataCollector::BeginDestroy() //////////////////////
{
	Super::BeginDestroy();

	if (ParticlesArr.Num() > 0)
	{
		for (auto i = 0; i < ParticlesArr.Num(); i++)
		{

			UParticleSystemComponent* D = Cast<UParticleSystemComponent>(ParticlesArr[i]);
			if (D != NULL)
				D->DeactivateSystem();
		}
		ParticlesArr.Empty();
	}
}
void UARFXEffectComponent::SimulateHitOnClients(FVector Origin, FVector Location, FName StartSocket)
{
	//FVector Origin = UARTraceStatics::GetStartLocation(SocketName, Causer);
	//UARTraceStatics::GetHitResult(10000, StartSocket, )
	//if ()
	//{
		if (TrailFXPar)
		{
			UParticleSystemComponent* TrailPSC = UGameplayStatics::SpawnEmitterAtLocation(GetOwner(), TrailFXPar, Origin);
			if (TrailPSC)
			{
				const FVector AdjustedDir = (Location - Origin).SafeNormal();
				FVector ParticleSpeed = AdjustedDir * TrailSpeedPar;
				TrailPSC->SetVectorParameter(TrailSpeedParamName, ParticleSpeed);
			}
		}
	//}
}
FReply FParticleSystemComponentDetails::OnResetEmitter()
{
	const TArray< TWeakObjectPtr<UObject> >& SelectedObjects = DetailLayout->GetDetailsView().GetSelectedObjects();
	// Iterate over selected Actors.
	for (int32 Idx = 0; Idx < SelectedObjects.Num(); ++Idx)
	{
		if (SelectedObjects[Idx].IsValid())
		{
			UParticleSystemComponent* PSC = Cast<UParticleSystemComponent>(SelectedObjects[Idx].Get());
			if (!PSC)
			{
				if (AEmitter* Emitter = Cast<AEmitter>(SelectedObjects[Idx].Get()))
				{
					PSC = Emitter->GetParticleSystemComponent();
				}
			}

			// If the object selected to the details view is a template, then we need to redirect the reset to the preview instance (e.g. in the Blueprint editor).
			// @todo Can remove this if we switch to instance-based editing in the Blueprint editor.
			if (PSC && PSC->IsTemplate())
			{
				TArray<UObject*> Instances;
				PSC->GetArchetypeInstances(Instances);
				UObject** ElementPtr = Instances.FindByPredicate([](const UObject* Element)
				{
					const AActor* Owner = Cast<AActor>(Element->GetOuter());
					return Owner != nullptr && FActorEditorUtils::IsAPreviewOrInactiveActor(Owner);
				});

				if (ElementPtr)
				{
					PSC = Cast<UParticleSystemComponent>(*ElementPtr);
				}
			}

			if (PSC)
			{
				PSC->ResetParticles();
				PSC->ActivateSystem();
			}
		}
	}
	return FReply::Handled();
}
void AHeatmapDataCollector::PostEditChangeProperty(FPropertyChangedEvent & PropertyChangedEvent)
{
	Super::PostEditChangeProperty(PropertyChangedEvent);

	if (ParticlesArr.Num() > 0)
	{
		for (auto i = 0; i < ParticlesArr.Num(); i++)
		{

			UParticleSystemComponent* D = Cast<UParticleSystemComponent>(ParticlesArr[i]);
			if (D != NULL)
				D->DeactivateSystem();
		}
		ParticlesArr.Empty();
	}
	FText CharctesP = FText::FromString(FString::FromInt(CharNumberInWorld));// = FString::FromInt(CharNumberInWorld);
	TextComponent->SetText(CharctesP);
	BuildSplinePath(CharNumberInWorld);
}
void ASWeaponInstant::SpawnTrailEffects(const FVector& EndPoint)
{
    // Keep local count for effects
    BulletsShotCount++;

    const FVector Origin = GetMuzzleLocation();
    FVector ShootDir = EndPoint - Origin;

    // Only spawn if a minimum distance is satisfied.
    if (ShootDir.Size() < MinimumProjectileSpawnDistance)
    {
        return;
    }

    if (BulletsShotCount % TracerRoundInterval == 0)
    {
        if (TracerFX)
        {
            ShootDir.Normalize();
            UGameplayStatics::SpawnEmitterAtLocation(this, TracerFX, Origin, ShootDir.Rotation());
        }
    }
    else
    {
        // Only create trails FX by other players.
        ASCharacter* OwningPawn = GetPawnOwner();
        if (OwningPawn && OwningPawn->IsLocallyControlled())
        {
            return;
        }

        if (TrailFX)
        {
            UParticleSystemComponent* TrailPSC = UGameplayStatics::SpawnEmitterAtLocation(this, TrailFX, Origin);
            if (TrailPSC)
            {
                TrailPSC->SetVectorParameter(TrailTargetParam, EndPoint);
            }
        }
    }
}
void UFlareAsteroidComponent::SetupEffects(bool Icy)
{
	IsIcyAsteroid = Icy;
	Effects.Empty();
	EffectsKernels.Empty();

	AFlareAsteroid* Asteroid = Cast<AFlareAsteroid>(GetOwner());
	int32 Multiplier = Asteroid ? Asteroid->EffectsMultiplier : 1;

	// Create random effects
	for (int32 Index = 0; Index < Multiplier * EffectsCount; Index++)
	{
		EffectsKernels.Add(FMath::VRand());

		UParticleSystemComponent* PSC = UGameplayStatics::SpawnEmitterAttached(
			IceEffectTemplate,
			this,
			NAME_None,
			GetComponentLocation(),
			FRotator::ZeroRotator,
			EAttachLocation::KeepWorldPosition,
			false);

		PSC->SetWorldScale3D(EffectsScale * FVector(1, 1, 1));
		Effects.Add(PSC);

		if (IsIcyAsteroid)
		{
			PSC->SetTemplate(IceEffectTemplate);
		}
		else
		{
			PSC->SetTemplate(DustEffectTemplate);
		}
	}
}
void FCascadeEdPreviewViewportClient::Draw(FViewport* Viewport, FCanvas* Canvas)
{
	if (!CascadePtr.IsValid())
	{
		return;
	}

	Canvas->Clear( GetPreviewBackgroundColor());

	// Clear out the lines from the previous frame
	CascadePreviewScene.ClearLineBatcher();

	ULineBatchComponent* LineBatcher = CascadePreviewScene.GetLineBatcher();
	CascadePreviewScene.RemoveComponent(LineBatcher);

	const FVector XAxis(1,0,0); 
	const FVector YAxis(0,1,0); 
	const FVector ZAxis(0,0,1);

	if (GetDrawElement(OriginAxis))
	{
		FMatrix ArrowMatrix = FMatrix(XAxis, YAxis, ZAxis, FVector::ZeroVector);
		LineBatcher->DrawDirectionalArrow(ArrowMatrix, FColorList::Red, 10.f, 1.0f, SDPG_World);

		ArrowMatrix = FMatrix(YAxis, ZAxis, XAxis, FVector::ZeroVector);
		LineBatcher->DrawDirectionalArrow(ArrowMatrix, FColorList::Green, 10.f, 1.0f, SDPG_World);

		ArrowMatrix = FMatrix(ZAxis, XAxis, YAxis, FVector::ZeroVector);
		LineBatcher->DrawDirectionalArrow(ArrowMatrix, FColorList::Blue, 10.f, 1.0f, SDPG_World);
	}

	if (GetDrawElement(WireSphere))
	{
		FVector Base(0.f);
		FColor WireColor = FColor::Red;
		const int32 NumRings = 16;
		const float RotatorMultiplier = 360.f / NumRings;
		const int32 NumSides = 32;
		for (int32 i = 0; i < NumRings; i++)
		{
			FVector RotXAxis;
			FVector RotYAxis;
			FVector RotZAxis;

			FRotationMatrix RotMatrix(FRotator(i * RotatorMultiplier, 0, 0));
			RotXAxis = RotMatrix.TransformPosition(XAxis);
			RotYAxis = RotMatrix.TransformPosition(YAxis);
			RotZAxis = RotMatrix.TransformPosition(ZAxis);
			LineBatcher->DrawCircle(Base, RotXAxis, RotYAxis, WireColor, WireSphereRadius, NumSides, SDPG_World);
			LineBatcher->DrawCircle(Base, RotXAxis, RotZAxis, WireColor, WireSphereRadius, NumSides, SDPG_World);
			LineBatcher->DrawCircle(Base, RotYAxis, RotZAxis, WireColor, WireSphereRadius, NumSides, SDPG_World);

			RotMatrix = FRotationMatrix(FRotator(0, i * RotatorMultiplier, 0));
			RotXAxis = RotMatrix.TransformPosition(XAxis);
			RotYAxis = RotMatrix.TransformPosition(YAxis);
			RotZAxis = RotMatrix.TransformPosition(ZAxis);
			LineBatcher->DrawCircle(Base, RotXAxis, RotYAxis, WireColor, WireSphereRadius, NumSides, SDPG_World);
			LineBatcher->DrawCircle(Base, RotXAxis, RotZAxis, WireColor, WireSphereRadius, NumSides, SDPG_World);
			LineBatcher->DrawCircle(Base, RotYAxis, RotZAxis, WireColor, WireSphereRadius, NumSides, SDPG_World);
		}
	}

	FEngineShowFlags SavedEngineShowFlags = EngineShowFlags;

	if (GetDrawElement(Bounds))
	{
		EngineShowFlags.SetBounds(true);
		EngineShowFlags.Game = 1;
	}

	EngineShowFlags.SetVectorFields(GetDrawElement(VectorFields));

	CascadePreviewScene.AddComponent(LineBatcher,FTransform::Identity);


	FEditorViewportClient::Draw(Viewport, Canvas);

	EngineShowFlags = SavedEngineShowFlags;
	FCanvasTextItem TextItem( FVector2D::ZeroVector, FText::GetEmpty(), GEngine->GetTinyFont(), FLinearColor::White );
	if (GetDrawElement(ParticleCounts) || GetDrawElement(ParticleTimes) || GetDrawElement(ParticleEvents) || GetDrawElement(ParticleMemory) || GetDrawElement(ParticleSystemCompleted))
	{
		// 'Up' from the lower left...
		FString strOutput;
		const int32 XPosition = Viewport->GetSizeXY().X - 5;
		int32 YPosition = Viewport->GetSizeXY().Y - (GetDrawElement(ParticleMemory) ? 15 : 5);

		UParticleSystemComponent* PartComp = CascadePtr.Pin()->GetParticleSystemComponent();

		int32 iWidth, iHeight;

		if (PartComp->EmitterInstances.Num())
		{
			for (int32 i = 0; i < PartComp->EmitterInstances.Num(); i++)
			{
				FParticleEmitterInstance* Instance = PartComp->EmitterInstances[i];
				if (!Instance || !Instance->SpriteTemplate)
				{
					continue;
				}
				UParticleLODLevel* LODLevel = Instance->SpriteTemplate->GetCurrentLODLevel(Instance);
				if (!LODLevel)
				{
					continue;
				}

				strOutput = TEXT("");
				if (Instance->SpriteTemplate->EmitterRenderMode != ERM_None)
				{
					UParticleLODLevel* HighLODLevel = Instance->SpriteTemplate->GetLODLevel(0);
					if (GetDrawElement(ParticleCounts))
					{
						strOutput += FString::Printf(TEXT("%4d/%4d"), 
							Instance->ActiveParticles, HighLODLevel->PeakActiveParticles);
					}
					if (GetDrawElement(ParticleTimes))
					{
						if (GetDrawElement(ParticleCounts))
						{
							strOutput += TEXT("/");
						}
						strOutput += FString::Printf(TEXT("%8.4f/%8.4f"), 
							Instance->EmitterTime, Instance->SecondsSinceCreation);
					}
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
					if (GetDrawElement(ParticleEvents))
					{
						if (GetDrawElement(ParticleCounts) || GetDrawElement(ParticleTimes))
						{
							strOutput += TEXT("/");
						}
						strOutput += FString::Printf(TEXT("Evts: %4d/%4d"), Instance->EventCount, Instance->MaxEventCount);
					}
#endif	//#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
					UCanvas::ClippedStrLen(GEngine->GetTinyFont(), 1.0f, 1.0f, iWidth, iHeight, *strOutput);
					TextItem.SetColor( Instance->SpriteTemplate->EmitterEditorColor );
					TextItem.Text = FText::FromString( strOutput );
					Canvas->DrawItem( TextItem, XPosition - iWidth, YPosition - iHeight );
					YPosition -= iHeight - 2;
				}
			}

			if (GetDrawElement(ParticleMemory))
			{
				YPosition = Viewport->GetSizeXY().Y - 5;
				FString MemoryOutput = FString::Printf(TEXT("Template: %.0f KByte / Instance: %.0f KByte"), 
					(float)ParticleSystemRootSize / 1024.0f + (float)ParticleModuleMemSize / 1024.0f,
					(float)PSysCompRootSize / 1024.0f + (float)PSysCompResourceSize / 1024.0f);
				UCanvas::ClippedStrLen(GEngine->GetTinyFont(), 1.0f, 1.0f, iWidth, iHeight, *MemoryOutput);
				TextItem.SetColor( FLinearColor::White );
				TextItem.Text = FText::FromString( MemoryOutput );
				Canvas->DrawItem( TextItem, XPosition - iWidth, YPosition - iHeight );				
			}
		}
		else
		{
			for (int32 i = 0; i < PartComp->Template->Emitters.Num(); i++)
			{
				strOutput = TEXT("");
				UParticleEmitter* Emitter = PartComp->Template->Emitters[i];
				UParticleLODLevel* LODLevel = Emitter->GetLODLevel(0);
				if (LODLevel && LODLevel->bEnabled && (Emitter->EmitterRenderMode != ERM_None))
				{
					if (GetDrawElement(ParticleCounts))
					{
						strOutput += FString::Printf(TEXT("%4d/%4d"), 
							0, LODLevel->PeakActiveParticles);
					}
					if (GetDrawElement(ParticleTimes))
					{
						if (GetDrawElement(ParticleCounts))
						{
							strOutput += TEXT("/");
						}
						strOutput += FString::Printf(TEXT("%8.4f/%8.4f"), 0.f, 0.f);
					}
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
					if (GetDrawElement(ParticleEvents))
					{
						if (GetDrawElement(ParticleCounts) || GetDrawElement(ParticleTimes))
						{
							strOutput += TEXT("/");
						}
						strOutput += FString::Printf(TEXT("Evts: %4d/%4d"), 0, 0);
					}
#endif	//#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
					UCanvas::ClippedStrLen(GEngine->GetTinyFont(), 1.0f, 1.0f, iWidth, iHeight, *strOutput);
					TextItem.SetColor( Emitter->EmitterEditorColor );
					TextItem.Text = FText::FromString( strOutput );
					Canvas->DrawItem( TextItem, XPosition - iWidth, YPosition - iHeight );					
					YPosition -= iHeight - 2;
				}
			}

			if (GetDrawElement(ParticleMemory))
			{
				YPosition = Viewport->GetSizeXY().Y - 5;
				FString MemoryOutput = FString::Printf(TEXT("Template: %.0f KByte / Instance: %.0f KByte"), 
					(float)ParticleSystemRootSize / 1024.0f + (float)ParticleModuleMemSize / 1024.0f,
					(float)PSysCompRootSize / 1024.0f + (float)PSysCompResourceSize / 1024.0f);
				UCanvas::ClippedStrLen(GEngine->GetTinyFont(), 1.0f, 1.0f, iWidth, iHeight, *MemoryOutput);
				TextItem.SetColor( FLinearColor::White );
				TextItem.Text = FText::FromString( MemoryOutput );
				Canvas->DrawItem( TextItem, XPosition - iWidth, YPosition - iHeight );				
			}
		}

		if (GetDrawElement(ParticleSystemCompleted))
		{
			if (PartComp->HasCompleted())
			{
				TextItem.SetColor(FLinearColor::White);
				TextItem.Text = LOCTEXT("SystemCompleted", "Completed");
				TextItem.bCentreX = true;
				TextItem.bCentreY = true;
				Canvas->DrawItem(TextItem, Viewport->GetSizeXY().X * 0.5f, Viewport->GetSizeXY().Y - 10);
				TextItem.bCentreX = false;
				TextItem.bCentreY = false;
			}
		}
	}

	//Display a warning message in the preview window if the system has no fixed bounding-box and contains a GPU emitter.
	if(CascadePtr.Pin()->GetParticleSystem()->bUseFixedRelativeBoundingBox == false)
	{
		UParticleSystemComponent* PartComp = CascadePtr.Pin()->GetParticleSystemComponent();
		if (PartComp->EmitterInstances.Num())
		{
			//We iterate over the emitter instances to find any that contain a GPU Sprite TypeData module. If found, we draw the warning message.
			for (int32 i = 0; i < PartComp->EmitterInstances.Num(); i++)
			{
				FParticleEmitterInstance* Instance = PartComp->EmitterInstances[i];
				if(!Instance || !Instance->SpriteTemplate)
				{
					continue;
				}

				UParticleLODLevel* LODLevel = Instance->SpriteTemplate->GetCurrentLODLevel(Instance);
				if (!LODLevel || !LODLevel->TypeDataModule)
				{
					continue;
				}

				const bool bIsAGPUEmitter = LODLevel->TypeDataModule->IsA(UParticleModuleTypeDataGpu::StaticClass());
				if(bIsAGPUEmitter)
				{
					const int32 XPosition = 5;
					const int32 YPosition = Viewport->GetSizeXY().Y - 75.0f;
					FString strOutput = NSLOCTEXT("Cascade", "NoFixedBounds_Warning", "WARNING: This particle system has no fixed bounding box and contains a GPU emitter.").ToString();
					TextItem.SetColor( FLinearColor::White );
					TextItem.Text = FText::FromString( strOutput );
					Canvas->DrawItem( TextItem, XPosition, YPosition );					
					break;
				}
			}
		}
	}

	int32 DetailMode = CascadePtr.Pin()->GetDetailMode();
	
	if (DetailMode != DM_High)
	{
		FString DetailModeOutput = FString::Printf(TEXT("DETAIL MODE: %s"), (DetailMode == DM_Medium)? TEXT("MEDIUM"): TEXT("LOW"));
		TextItem.SetColor( FLinearColor::Red );
		TextItem.Text = FText::FromString( DetailModeOutput );
		Canvas->DrawItem( TextItem, 5.0f, Viewport->GetSizeXY().Y - 90.0f );		
	}

	if (GEngine->bEnableEditorPSysRealtimeLOD)
	{
		TextItem.SetColor( FLinearColor(0.25f, 0.25f, 1.0f) );
		TextItem.Text = LOCTEXT("LODPREVIEWMODEENABLED","LOD PREVIEW MODE ENABLED");
		Canvas->DrawItem( TextItem,  5.0f, Viewport->GetSizeXY().Y - 105.0f );		
	}

	EParticleSignificanceLevel ReqSignificance = CascadePtr.Pin()->GetRequiredSignificance();
	if (ReqSignificance != EParticleSignificanceLevel::Low)
	{
		FString ReqSigOutput = FString::Printf(TEXT("REQUIRED SIGNIFICANCE: %s"), (ReqSignificance == EParticleSignificanceLevel::Medium) ? TEXT("MEDIUM") : ((ReqSignificance == EParticleSignificanceLevel::High) ? TEXT("HIGH") : TEXT("CRITICAL")));
		TextItem.SetColor(FLinearColor::Red);
		TextItem.Text = FText::FromString(ReqSigOutput);
		Canvas->DrawItem(TextItem, 5.0f, Viewport->GetSizeXY().Y - 120.0f);
	}

	if (bCaptureScreenShot)
	{
		UParticleSystem* ParticleSystem = CascadePtr.Pin()->GetParticleSystem();
		int32 SrcWidth = Viewport->GetSizeXY().X;
		int32 SrcHeight = Viewport->GetSizeXY().Y;
		// Read the contents of the viewport into an array.
		TArray<FColor> OrigBitmap;
		if (Viewport->ReadPixels(OrigBitmap))
		{
			check(OrigBitmap.Num() == SrcWidth * SrcHeight);

			// Resize image to enforce max size.
			TArray<FColor> ScaledBitmap;
			int32 ScaledWidth	 = 512;
			int32 ScaledHeight = 512;
			FImageUtils::ImageResize(SrcWidth, SrcHeight, OrigBitmap, ScaledWidth, ScaledHeight, ScaledBitmap, true);

			// Compress.
			FCreateTexture2DParameters Params;
			Params.bDeferCompression = true;
			ParticleSystem->ThumbnailImage = FImageUtils::CreateTexture2D(ScaledWidth, ScaledHeight, ScaledBitmap, ParticleSystem, TEXT("ThumbnailTexture"), RF_NoFlags, Params);

			ParticleSystem->ThumbnailImageOutOfDate = false;
			ParticleSystem->MarkPackageDirty();
		}

		bCaptureScreenShot = false;
	}
}
Beispiel #13
0
bool AHeatmapDataCollector::BuildSplinePath(uint8 CharNumberIn /*= 0*/, bool isActive/*=true */)
{
	if (bBuildSpline)
	{
		if (PathSpline)
		{
			if (PathSpline->GetNumberOfSplinePoints() != 0)
			{
				PathSpline->ClearSplinePoints();
			}
			auto FileFrom = SaveDirectoryPath + "/" + LogFileName + "_" + FString::FromInt(CharNumberIn) + ".txt";
			bool DExists = FPlatformFileManager::Get().GetPlatformFile().FileExists(*FileFrom);//DirectoryExists(*FileFrom);
			if (DExists)///////////////////
			{

				//if (SplineDataSwitcher == ESplineDataSwitcher::ES_ArrayData)
				//{
				//	//TArray<int16> ArrayFromFile;
				//	auto FileFrom = SaveDirectoryPath + "/" + "ArrayLocationLogs.txt";
				//	LoadFileToArray(ArrayFromFile, *FileFrom, 0);
				//	FVector SplinePoint;
				//	SplinePoint.X = 0;
				//	SplinePoint.Y = 0;
				//	SplinePoint.Z = 0;
				//	for (size_t i = 0; i < ArrayFromFile.Num(); i++)
				//	{
				//		SplinePoint.X = (ArrayFromFile[i] < 12800 && ArrayFromFile[i] > -12800 ? ArrayFromFile[i] : GetActorLocation().X);
				//		i++;
				//		SplinePoint.Y = (ArrayFromFile[i] < 12800 && ArrayFromFile[i] > -12800 ? ArrayFromFile[i] : GetActorLocation().Y);
				//		i++;
				//		SplinePoint.Z = (ArrayFromFile[i] < 12800 && ArrayFromFile[i] > -5000 ? ArrayFromFile[i] : GetActorLocation().Z);
				//		PathSpline->AddSplineWorldPoint(SplinePoint);
				//	}
				//}
				if (SplineDataSwitcher == ESplineDataSwitcher::ES_StringData)
				{
					FString StringFromFile;
					ParseCoordsFromFile(StringFromFile, *FileFrom);

					if (ParticlesArr.Num() > 0)
					{
						for (auto i = 0; i < ParticlesArr.Num(); i++)
						{

							UParticleSystemComponent* D = Cast<UParticleSystemComponent>(ParticlesArr[i]);
							if (D != NULL)
								D->DeactivateSystem();
						}
						ParticlesArr.Empty();
					}

					int32 numSplinePoints = PathSpline->GetNumberOfSplinePoints();
					for (auto pointIdx = 0; pointIdx < numSplinePoints; pointIdx++)
					{
						const FName Source = FName(TEXT("Source"));
						const FName SourceTan = FName(TEXT("Source_Tan"));
						const FName Target = FName(TEXT("Target"));
						const FName TargetTan = FName(TEXT("Target_Tan"));
						const FName TeamColorParam = FName(TEXT("TeamColor"));

						FVector sourceBeamLocation = PathSpline->GetLocationAtSplinePoint(pointIdx, ESplineCoordinateSpace::World);
						FRotator sourceBeamRot;
						sourceBeamRot.Pitch = 0;
						sourceBeamRot.Yaw = 0;
						sourceBeamRot.Roll = 0;
						float sourceDistanceAlongSpline = PathSpline->GetDistanceAlongSplineAtSplinePoint(pointIdx);
						FVector sourceTangentAtDistance = PathSpline->GetTangentAtDistanceAlongSpline(sourceDistanceAlongSpline, ESplineCoordinateSpace::World);

						FVector targetBeamLocation = PathSpline->GetLocationAtSplinePoint(pointIdx + 1, ESplineCoordinateSpace::World);
						float targetDistanceAlongSpline = PathSpline->GetDistanceAlongSplineAtSplinePoint(pointIdx + 1);
						FVector targetTangentAtDistance = PathSpline->GetTangentAtDistanceAlongSpline(targetDistanceAlongSpline, ESplineCoordinateSpace::World);

						if (GetWorld())
						{
							UParticleSystemComponent* Spawner = UGameplayStatics::SpawnEmitterAtLocation(this, BeamParticle, sourceBeamLocation, sourceBeamRot, true);////ftom world to this

							UParticleSystemComponent* chek = Cast<UParticleSystemComponent>(Spawner);
							if (chek)
							{
								ParticlesArr.Add(Spawner);
								if (Spawner)
								{
									Spawner->SetVectorParameter(Source, sourceBeamLocation);
									Spawner->SetVectorParameter(SourceTan, sourceTangentAtDistance);
									Spawner->SetVectorParameter(Target, targetBeamLocation);
									Spawner->SetVectorParameter(TargetTan, targetTangentAtDistance);
									Spawner->SetColorParameter(TeamColorParam, TeamColor);

								}
							}
						}

					}
					return true;//
				}
			}

		}
	}
	if (isActive == false)																	/// clearing particles
	{
		for (auto i = 0; i < ParticlesArr.Num(); i++)
		{

			UParticleSystemComponent* D = Cast<UParticleSystemComponent>(ParticlesArr[i]);
			if (D != NULL)
				D->DeactivateSystem();
		}
		ParticlesArr.Empty();
	}
	return false;
}