I am implementing procedural level generation using a binary space partitioning algorithm that spawns arbitrary actors within each node, similar to Unreal Engine 4 Training Twitch: Procedural Room Generation.
My AtidLeafNode class derives from AActor as it needs a position vector to determine where the node is in the world and thus calculate the bounds of which it can spawn an actor. It has two private member variables:
UPROPERTY()
AtidLeafNode* LeftChild;
UPROPERTY()
AtidLeafNode* RightChild;
I have a member function Split() which continually breaks down the root LeafNode to create smaller ones. So inside the function I need to make several calls to SpawnActor as such:
LeftChild = a_World->SpawnActor(AtidLeafNode::StaticClass());
RightChild = a_World->SpawnActor(AtidLeafNode::StaticClass());
These lines throw me a compiler error: “2 overloads have no legal conversion for ‘this’ pointer.”
I have tried other custom typed AActors with no luck as well.
According to 14 - Coding What, Where, and When to Spawn you are able to spawn actors from inside an actor. What am I doing wrong?
Cheers.