I want to be able to attach rigid bodies to an entity while they move. I want to be able to pick up an enemy and throw him like an object while still retaining the AI.
Is that even possible? Any help is appreciated.
It's probably possible if you wanted to modify the game's base code and object types. I don't think AI and interactable (read: you can pick them up) objects overlap at all.
Attaching rigid bodies shouldn't be impossible though if you open the model editor. I could be wrong though ¯\_(ツ)_/¯ never tried experimenting with this stuff before.
I tried merging the coral puppet's AI with the AI script of prop_rigid but it didn't do anything. I tried adding bodies to the character both in the model and level editor but they either push the enemy out of the map and destroying their in-built physics or float independently from the puppet.
This is super frustrating to get working.
The attaching thing is quite possible, and is actually not too terribly difficult. IIRC, in the Level Editor, if you add an entity name to an entity's ParentAttachEntity field (under "Attachments"), the entity will then be attached to the parent, and will move around relative to its parent's position and rotation.
The picking up and throwing of enemies, however, will be quite a bit more complex. In order for something to be picked up and thrown, it needs to have a physics body. Monster entities already have a character body, however, and as you've already discovered in your experimentation, physics bodies and character bodies do not play well together. The only recourses to approach this problem would then have to be two-fold: design the physics body so that it is as close to the character body as possible without actually touching, or have two different versions for each entity (one with the character body and one with the physics body) and swap them around based on when they are being interacted with. The former option seems impractical, as it would require a ton of trial and error and the end result would likely be error prone, so I'd say the latter would be your best option.
As a starting point, I'd say that an optimal solution might be to check out Subnautica for an idea of how to implement this. In Subnautica, the player grabs the fish and holds them in his hand. In practice, I would guess that those two objects are actually completely different entities, and when the player grabs a fish, the game is actually destroying the fish in the world and creating a fresh version of the fish to display in the player's hand (which, incidentally, is exactly the same thing that happens in SOMA when you pick up a tool).