Can't Change Root Component Type
Hi, I've been having a problem for a while that I can't find a way to resolve on my own, and haven't seen anything on the forums that adequately addressed it.
I use a parent class (item_carryable) which contains the logic for items in my game (which is the vast majority of objects that aren't static in the map) so that you can pick them up, attach them to your character, and so forth. The item_carryable class has uses a Static Mesh as a root. Whenever I make new items derived from it, I just change the model in the field and it works fine.
However, I have a number of items (bags, furs, etc) that I need to be skeletal meshes. Unfortunately, there is no way that I can find to change the type of the root component from Static Mesh to Skeletal Mesh for the child. This becomes a problem because then I have to make the skeletal mesh be a sub-component of the Static Mesh root which is, well, nothing. This means I can't enable or disable physics in any way that doesn't break the whole thing - if I enable physics on the static mesh, it's an empty component that does nothing except maybe fall through the world. If I enable physics on the skeletal mesh sub-component, it immediately becomes separated from the actor it belongs to, because it detaches from the root, which leads to more bullcrap down the road.
The aforementioned reason is also why I can't use a Scene Component as the root, for example, because that can't handle physics properly. Is there any way that one change the root mesh from the static to the skeletal, either in the editor or in blueprints? If there is a C++ way, I'm also open to hearing it
asked Aug 25 '16 at 03:15 AM in Blueprint Scripting
So, without knowing how many children you have. You can easily just keep the StaticMesh as the root, set physics to it (have to assign a mesh), use THAT to move, while keeping it Hidden In game. The Skeletal Mesh will move along with it. Just tested it and that works.
If not, you have to redesign your whole system from scratch.
you could make ItemCarryable into an interface, then make 2 pickup actors that implement that interface: ItemStatic and ItemSkeletal. then any communication you would normally do with the base class, can be done through ItemCarryable interface functions.
then, if you decide you want to carry a character or a vehicle as if it were a weapon, you can just let them implement ItemCarryable.
answered Aug 25 '16 at 03:52 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here