The player’s skeletal mesh has it’s bones simulated and has a ‘Physical Animation’ component for a “active ragdoll” effect.
This works fine until the player is attached to another moving object.
When the player gets in the cart, I use an ‘Attach Actor To Component’ node with the player being the target and the Parent being the seat of the cart.
When the player is above a certain speed with the cart, the mesh will start to lag away from their capsule component.
The intended design is for the player to maintain it’s mesh location with it’s collision capsule, while the mesh is in ‘active ragdoll’, and the capsule collision remains attached to the cart.
What I’ve Tried
- They are both physics objects, so I tried using a physics constraint method for this as well. Unfortunately, this would result in the player ALWAYS being the parent in the relationship no matter which one I plugged into the component or enabling ‘parent dominates’, and would result in the cart not being able to move at all. I realized it wouldn’t move because the player’s root had Kinematic physics type, but even when switching it to Simulated physics type after they got in, this would lead to the exact same amount of lag that ‘Attach Actor To Component’ had. I’ve tried having the physics constraint being located in the player, as well as having it located in the cart, both produced the exact same issue.
- I’ve tried messing with the ‘Tick Group’ of every component involved, in an assortment of different combinations, and it didn’t change the lag. In fact, the only time anything changed when messing with the ‘Tick Group’ was when I set the Mesh ‘Tick Group’ from Pre-Physics to During Physics, and all that did was made it lag even more.
- I thought the problem could have been with the speed that player is able to achieve in the cart compared to when they’re walking, but giving the player a tremendous walk speed didn’t produce any lag at all between the mesh and it’s capsule.
- I also tried resetting the ‘Set Skeletal Mesh Component’ once they’re in the cart, and increasing the amount of strength with the ‘PhysicalAnimationData’, neither produced any significant changes.
- I messed with the dampening of both the character and the cart, from 0 to 10000, and still produced lag (or didn’t move at all obviously).
- I’ve tried it without any animation at all, but still get the same lag.
- I’ve messed with the mass of both the cart and the player to varying degrees.
- Setting the mesh location every tick also results in the same issue.
- I tried turning the sampling and iterations of physics up in the project settings, this produced no significant changes.
I don’t think the problem is with the cart, but more with how the mesh calculates it’s position with it’s collision capsule when the collision capsule is attached to the cart, or possibly even the character movement component itself.
Theoretically, the player could be standing in the cart (not attached), the cart could move at any speed, and it would never result in lag with the mesh and it’s capsule, the problem only happens after the capsule is attached to the cart.
I’ve exhausted every possible resource I could into trying to figure this out, through AI, to reading endless posts with an even slightly similar physics issue, and I can’t figure it out. I really hope it’s something stupid that I missed and it’s an easy fix, but I am truly at a loss at this point and desperate for help.