Static Mesh Actor
I am new to game development and Unreal Engine 4. I am using version 4.7
I have for example 8 chairs and 8 tables. I have converted everything into fbx files using Autodesk. After importing in Unreal Editor, I followed the basic tutorial.
As I am a beginner, I have seen with basic C++ programming and followed this https://docs.unrealengine.com/latest/INT/Programming/QuickStart/index.html link and I created a basic Actor class. After building it, I placed 8 Actor class into the viewport and changed that to StaticMesh to Chair1-8.
The problem is, I do not want to change that each Actor class to StaticMesh as Chair. It should automatically recognize the class as StaticMesh for all the 8 Chairs.
Can somebody please help me to find the solution for this issue.
Any code or tutorial might help.
Thanks in advance!
asked Mar 09 '15 at 01:54 PM in C++ Programming
The esiest way on doing it would be creating a Parent class that holds a list of static meshe. Create an enum blueprint type and add an entry for each of your chairs and add a variable of that enum type to your BP class. Now in the PostInitializeComponents method you check if there is a mesh in your list for the given enum type and if yes change the mesh of the StaticMeshComponent.
The next part would be creating a BP class that inherits from your C++ class, in the defaults section of that class just fill the array with the meshes you would like to use (1-8 chair meshes). Now each time you change the enum the mesh will change. To go a step further you can create another class that inherit from your BP class setting the enum value by default to a given one, this way you can then just drop a specific type of chair.
I recommend creating such a relationship between C++ and BP so that you hold any real content reference in BP space, this will help you when you package your game and you cook your content. References should only be set in BP for simplicity, flexibility and to only load the required resources at any moment.
If you have different chair base BP classes that can hold different meshes just create a list that contains each enum to later see if it is there, this is like a list of linkes which maps an enum value to an index of the available meshes list.
EDIT: I'm resolving the issue for now, if you need any further assistance please reopen it ^^ Hope you where able to achieve your goals
I think if tou wanted to do that sequentially or make sure that every chair is different it would need more work. But the idea is just make an array of staticmesh and assign that in your staticmeshcomponent, you can do that in the construction script in the blueprint or on your construction method in your class, or in yhe postInitializeComponents function or others (please read ue4 doc of actor initialization step). I think i have seen some implementation of this in youtube. Just search crowd system test ue4 in youtube. I think in some videos the author to this mechanics to change the mesh
answered Mar 10 '15 at 02:14 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here