FMath::SegmentIntersection2D in Blueprint?

Is there a Method to use FMath::SegmentIntersection2D (and others) in Blueprint, that I am just not seeing?
Or is there an Blueprint alternitive?

Is not hard to implement in C++ a plugin module that exposes that function to blueprints

H:

	UFUNCTION(BlueprintCallable, meta = (DisplayName = "SegmentIntersection2D"), Category = "UE_BP_extrasTesting")
	static bool SegmentIntersection2D(FVector segmentA_Start, FVector segmentA_End, FVector segmentB_Start, FVector segmentB_End, FVector &Loc);

CPP:

bool UUE_BP_extrasBPLibrary::SegmentIntersection2D(FVector segmentA_Start, FVector segmentA_End, FVector segmentB_Start, FVector segmentB_End, FVector &Loc)
{
	return FMath::SegmentIntersection2D(segmentA_Start,segmentA_End,segmentB_Start,segmentB_End,Loc);
}

image

Good Luck!
dany

2 Likes

In UE5 I get a ton of Compiler Errors in Visual Studio (2019 and 2022).
Mainly C2653 Schweregrad Code Beschreibung Projekt Datei Zeile UnterdrĂĽckungszustand
Fehler C2653 “UUE_BP_extrasBPLibrary”: Keine Klasse oder Namespace MyProject D:\Master Project Folder\MyProject\Source\MyProject\MyBlueprintFunctionLibrary.cpp 6

and a lot E0070 Errors

You probably put in the wrong path to the header file of the library. I think you added your project name by accident.

You can also check if you have matching _api statement with the rest of your project (in lib header)

1 Like

That was one of the Reasons that caused issues. The other was Google Drive (it caused file access problems).

Now it is all compiling without errors. Yet, I can’t seem to find it in the Blueprints (same with a simple Code from a Tutorial).