How to spawn actors in design stage?
Hi all. So to set the scene, I have a number of .obj models and also files describing where those models should be placed (4x4 matrices, some models are placed multiple times, ...). I also have no experience with c++ (only similar languages) or with unreal engine.
How do I go about automizing the placement of those models in a scene at the design stage, so that I can still move em further around?
I found this tutorial : https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/SpawnAndDestroyActors/Blueprints/ and I think this simply doesn't work anymore in ue 4.16.
I also found this https://answers.unrealengine.com/questions/328407/ive-been-trying-to-spawn-an-actor-in-c-for-the-las.html . Now to call GetWorld(), I'd have to extend something like an actor, so that it can be placed in the world, and getworld can be called. but how can I run that code on my actor at design time?
Also, the question states that I have to "#include the thing I want to spawn". Does this mean that I have to include some kind of genericasset.h header, and pass the name of my model in the FActorSpawnParameters? Or do I have to 'include a model', if such a thing makes sense?
Theres this nice visual interface-programming, how are you supposed to combine it with some c++ scripts? I created a class that defined some functions, but have no clue how I could instantiate said class in the blueprint and call some functions on it.
And how would I preferably go about reading in the positions of all models, should I try to create some kind of csv formatted datatable?
Any help whatsoever would be greatly appreciated.
Alright, figured it out.
The trick is to create a c++ plugin. You can then spawn static meshes by executing :
I can now create a csv file containing the paths of my objects along with their mat4s, read it in somehow and use the Ftransform to apply the mat4s. Quite neat, all in all.
answered Jun 22 '17 at 12:55 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here