My application scenario is like this. I need to make a prop actor class. There are subclasses of equipment, weapons and so on The problem is that some subclasses use static mesh component, while others use skeletal mesh component These props may need physical simulation, such as rolling on the ground when falling.
I tried to use a bool to control constructors in C + +. I set RootComponent to a mesh component. Sometimes the mesh component is Static Mesh and sometimes is Skeletal Mesh (depending on the bool). However, after inheriting it with the blueprint class, I found that checking or not checking the bool has not affect whether the RootComponent is StaticMesh or SkeletalMesh, because the constructor of the C + + parent class is executed first, and the bool value set by the blueprint is executed after the C + + constructor is executed.
So I can only make the RootComponent a BoxCollisionComponent Then add StaticMesh or SkeletalMesh in the subclass, as this picture.
but if so, there is a problem, that is, the WorldTransform of Actor is equaled BoxCollisionComponent, not MeshComponent. Is there any way to make the WorldTransform of the BoxCollisionComponent, or the WorldTransform of Actor consistent with that of MeshComponent without affecting the physical simulation of meshcomponent?