Download

Drawing world from c++

Hi,
I want to be able to drawing on my editor from my c++ code.

Let me explain better.
It is possible from c++ code add new instance of an assent directly into editor scene. I want do something like a “world generator” from code.

Example:
Suppose that I want to do a race car game. Suppose that I have a street asset. Tipically from the editor I can move my StreetAsset into the scene and then I can modified some parameters. I want write an algorithm that insert my StreetAsset into the editor scene.

It’s possible? Any suggestions are appreciated.

Thanks a lot!

It’s possible, you have to extend an Actor class I suppose, and build all generator functionality there. Like spawning assets, location, rotation, stacking etc. Then spawn it and let it generate a world.

For example a very simple solution is:
Suppose you have a tiling model, with sizes 200x200x50 (for example)

You create a reference of it in C++ and then in BeginPlay() method, you would do something like:
NOTE: THIS IS PSEUDO CODE**



for(int i = 1; i < 11; i++)
{
     FVector3 Location = (0, 200 * i, 0);
     World->Spawn(myAsset, location);
}


That would spawn a mesh 10 times in a straight line.