How can I apply the same blueprint or code to multiple actors with different root components?


In my game I’m planning to have physics actors which can be fired at opponents to deal damage if the velocity is high enough.

Initially I had my Characters detect collisions with Event Hit, which worked great, but I needed to store an Instigator on the object itself so the damage can be traced back to the person who fired it.

Now, obviously I don’t want to copy and paste blueprint/code to all my different physics objects, so I decided I’d write a “WeaponizedPhysicsActor” class as a child of Actor, and then derive from that to make all my other potential physics objects with different meshes. I could then also detect the collision hits there instead of in Character.

The problem is, WeaponizedPhysicsActor must define a Root Component for some reason, however I need to be able to define the Root Component in all my other physics objects so that I can replicate the position over the network!

I’m not really sure what to try next, or if there are better ways of doing this.

Everything mentioned above has been in blueprint, however I can also use code.

Thanks for any help!

I tried writing the WeaponizedPhysicsActor in code instead, and it seems to not require a Root Component definition. I didn’t get to finish it, but I’ll accept this for now and reopen if it doesn’t work…