I have an “InteractiveObject” class based on Actor which has the following:
- a root node
- a StaticMeshComponent
- various user interaction functions like MouseOver(), MouseOff(), MouseClick(), etc.
Works great, but now I would like to compose interactive objects into equipment with various “InteractiveObjectComponents”. For example:
- a base equipment cabinet (“InteractiveObject”)
- a door to open the cabinet (“InteractiveObjectComponent”)
- a handle to unlatch the door (“InteractiveObjectComponent”)
- various electronic parts inside the cabinet (“InteractiveObjectComponent”)
The parent-child attachment can be arbitrarily deep (e.g. cabinet <- door <- handle) so I’m pretty sure they all have to be Actors?
Anyway, I’m having a bit of trouble creating and attaching the components in the base object’s C++ constructor. Anyone know of any examples of how to:
- create an actor
- assign it a static mesh
- attach it to another actor in the constructor (or wherever, it just has to show up in the editor and game)
The “InteractiveObjectComponent” needs to function similarly to StaticMeshComponent but with additional custom functionality for user interaction.