My evolving experience with UE4

After several weeks tinkering about with attaching meshes that simulate physics together I’ve come to the conclusion that it’s not possible to do without modifying the engine. Here’s the result of my experiments:

** 1. Straight parenting (ie, AttachParent = MyMesh)**

  • Produces a nice rigid attachment
  • Doesn’t work if you simulate physics, which means you can’t get Hit events
  • If the object collides with a physics object, the other object goes flying (ie, mass is infinite).
  • Seems reliable
  • Replicates well

** 2. Physics Constraint**

  • Allows physics to work, so you can get Hit events
  • Often not rigid, so you get wobbles. Can be sensitive to mass scaling
  • Seems to provide good physics interaction (ie, other objects don’t go flying)
  • I’ve had issues with replication becoming excessively jittery

** 3. Welding**

  • Produces a rigid attachment
  • Allows physics to work, although there are issues (see below), and it seems experimental (? new in 4.7)
  • Mass and center of mass move, seemingly independent of the mass of the attached object. This can be corrected via direct PhysX calls only.
  • Different collision settings on different components like Overlap or Block don’t seem to work, at least not for me.
  • It produced a bug where deleting Actor B caused a welded component on Actor A to detach and have it’s physics reset. The Actors are not related in any way, with no obvious references to each other.
  • Replicates well
  • Not sure how it works with skeletal meshes and other more dynamic content

** 4. Disabling forces on collisions but still generating Hit events**

  • Needs heavy modification of the engine physics
  • You need to write all of your own Force/Impulse code
  • Kind of defeats the purpose of having physics in the first place

I’ve decided to go with option 1, disable blocking, and put a single physics capsule/ mesh around the pawn for the collisions. Not ideal but should at least work.