Download

Best way of representing my own node graph inside unreal engine with?

Good evening,

for studyingpurpuses I have written a graph class in pure c++ which I want now to represent inside of unreal engine. It consists of 3 Classes:

Graph.ccp
Edge.ccp
Node.ccp

Only c++ was actuall easy but now I have tried to implement it using UE and it seems like quite difficult.
I have created a new type called Graph inherited from AActor. These are the Parameters:


UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Graph")
TArray<class AKnoten*> knotenliste;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Graph")
int32 nodesPerMetre;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
class UBoxComponent* nodeContainer;

Now every node should be in “knotenliste” (nodelist) so later I can iterate over it for the actual pathfinding.
Every node should have the nodeContainer as child.

But the real problem is: How would I actually implement a node and a edge ?
Should I let them derived from AActor too (How would I attach them to the graph)?
So each node would have a neighbour list, previous node, rating, staticmesh

Or should I just create static meshes represting nodes ?

Regards

PS.: I dont excpect any code just some food for thoughts :slight_smile:
I know there is already a build-in graph for pathfinding, but as I said I’ts only for studying purposes.