TLDR: I want to be able to set down towers and select their look with a single click and have the geometry be correct.
The actor class AShooter
handles the logic of targeting other actors and spawning projectiles. Conceptually the AShooter
has a base (purple), a turret (red) and a projectile spawn point (green):
What is the best C++/BP/Actor hierarchy or composition to allow selecting the visuals and geometry configuration of a specific AShooter
instance?
This used to all be contained in a single actor class but the logic of the shooting should be separate from the geometry representation which should be easily swappable in the editor. However, the projectile spawn point is needed by the logic in AShooter
and will depend on the geometry of the base and turret. So there should be a hierarchy of transforms which doesn’t seem to work with data assets.
Switching the geometry will necessitate the manual moving of the spawn point. It would be nice to have a handful of presets that can be selected for a shooter. The presets should be manually editable.
Defining an actor component which holds the base, turret and spawn point components does not allow setting their relative locations in the editor.
Is there a way to have a BP actor class of just these components which is then owned by the AShooter
? This would necessitate spawning an actor which is not ideal.
The requirements:
- The base, turret and spawn point are defined together for all presets (no mix and match)
- The turret mesh component is rotatable from within
AShooter
- The spawn location is attached to the turret so it inherits its transform
- The spatial configuration of base, turret and spawn point are configurable in a viewport
- The preset of any
AShooter
can be swapped/selected in the editor separately for any instance in the world - Avoiding hard references if possible to keep the classes small
- Swappable/selectable requirement is only for editor. No changes in packaged game.