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).
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.
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.