Physics animation blending = Instant crash

Hello! I’m trying to implement physics weighted animation into my animation blueprint, as shown here: Physics-Based Animation | Unreal Engine Documentation

However, the second I hook it up and press play, the editor just crashes.

I’ve probably just made a mistake in my BP, any ideas?

Possibly “when” it is being activated.
Remeber the call stack doesn’t necessarily have all the animation references on begin play.
Create a custom event and call it back from the begin play on the animation BP.
Same place where you should be setting up your initial cast to get a character variable to get data from.

Tried to set it at an event that triggers later so that things have an opportunity to load in first and got the skeletal mesh through the same event to make sure that I didn’t try to apply it to an empty reference. Still crashes I’m afraid.

Am I getting the skeletal mesh the right way, or is there a better way to do it?

Should be ok. Add another is valid to the mesh if you want to be really sure.
however, I would move the code to the character BP so there is no need for casting.
also, I know it works on actor bp, as that’s where I have it and it runs ok.
I wonder if its crashing because the reference to the physical animation component doesn’t exist in anim bp…
if you still have issues I’ll have a look

Putting it in the Character BP instead allowed me to clean it up and ensure a proper reference to the skeletal mesh, I also did some adjustments based on the old live training video on physical animations, but it still crashes I’m afraid. “Array out of bounds”

Array out of bounds? The only array should be the bones.
but even with a wrong bone name it shouldn’t crash… I’ll check if my system is still working right in a few.

No. No engine crash for me, even after adding the last node that I don’t usually use.
That said I haven’t even looked at ragdolling after adding in all the cloth and stuff, and now my character launches out of outerspace.
But, everything still works fine so let’s clean up your code.

No real need for the dealy on begin play character side. the component takes care of that I assume.
no real need for IsValid unless you replace the mesh at runtime which even if you do won’t matter. begin play fires off on construction and to change it, well, it has to be constructed. So you can avoid that paranoia here (not on the anim bp maybe).

What am I doing different?
Well, I have a function called to set the physics, and I have a physics profile setup that you don’t seem to have.
I’m using a MakeLiteralName in which I type pelvis (lowercase). for the SetAllBodiesBelowSimulatePhysics and include self is checked (root bone is kinematic I think).

Start ragdoll
disables movement (bool on inputs, and resets about 20 bools that are used for various possible movements).
stops movement. Chances movement mode to walking, sets movement velocity to 0 (from character movement component), toggles another 2 walking related bools.
Detaches camera (disable controller rotation yaw).
Sets any phys simulation (of the main mesh) to 0. that’s Set all physics linear velocity, and Set all physics Angular velocity.
And after that, it toggles on rag-doll.
First, Set all bodies below simulate physics. Second, Apply physical animation profile below.

That’s it.

IF I inject SetAllBodies below physics blend weight, I know the node works because with a weight of 0 my fingers that have no constraints lag behind.

Thanks for the testing! I decided to recreate the setup in a clean project to rule out if it was the way I used it that was the problem or something else within my project (or PC) breaking it.

This is all that was needed to make it work:


So I guess I’ll go over my character, animation BP, and c++ t and clean things up and see if I can find the source.
I’m not sure where to start looking since the error message isn’t very specific, but I suspect it might have to do with all the things I have attached to the character not knowing what to do when the character goes into ragdolling.

Edit: Disabled all the spawned attached actors, wasn’t any of those.

Edit2: Figured it out! Turns out simulate physics isn’t fond of per-poly collision on the skeletal mesh. I guess it competes with the physics of the physics asset.
I’ll have to make collisions work with my other physics assets then.