Controlling PhAT contraints during runtime


First, I would like to say that I am really surprised with UE4, especially the physics. I never did game writing, but have lots of background in 3D software and Coding.

I am trying to create a powered ragdoll which has walking/balancing algorithms to drive the joints/contraints.

Here is what I have done so far in my project (and which works nice!):

  1. I migrated the HeroTPP physics asset from the physical animation example, 2. created a nice camera logic that takes gamepad input (blue print looks like a bowl of spaghetti; it is basically the GTA 5 camera replicated) 3. turned HeroTPP into blueprint and added gamepad input to apply force/impulse and so on to my ragdoll’s bones (HeroTPP), 4. I added some rocks/geometry etc from the starter content

So now I have my ragdoll that I can have fly through the level, throw down cliffs etc. This works really nice and in a realistic fashion by adjusting the contraints in the PhAT to the ‘contraints’ of a human body, i.e. the joints and their limits. So no matter how hard and from how high I form my ragdoll around, it always stays in natural poses when crashing down cliffs etc.

Here is my question:

Is it possible to adjust the PhAT constraint parameters (swing limits, overall rotation, etc.) during runtime.
I did not find a way in blueprints, so I guess functions that can access and change the parameters need to be created from scratch by myself in C++.

I found ‘add torque’, ‘add angular velocity’ under Physics in the blueprint, and they work, but they do not serve me well. I need to change the constraint parameters directly to create something like a walking robot, but completely animation free.

There is this small game SUMOTORI, which has self-balancing ragdolls. There you can get the idea.

Hey dev100000,

You’re right that this is probably beyond the scope of the blueprint functions at the moment. Although it should be possible in code. You can access joints for a skeletal mesh through USkeletalMeshComponent::FindConstraintInstance providing the name of a constraint, or access joint array USkeletalMeshComponent::Constraints directly. Within FConstraintInstance there’s a bunch of methods for setting/updating the limits, drives and positions for the joint.

Hope that helps!


Hi Benn,
Thank you for your reply.
It is good to know that C++ Code can access skeletal mesh PhAT constraints.
When I look at the PhAT constraints, they are just normal constraints. So I was actually hoping that accessing them is possible, but that it has simply not been implemented yet into blueprints. It is not a common use case for UE4 after all to do self balancing ragdolls, or ‘powered’ ragdolls. If it works however, and with the rock-solid UE4 physics it should, then having truly animation-free gameplay would be amazing. Especially with the human-like PhAT constraints that already work so well, as described above.
Looking forward to digging into C++ again and to creating ragdoll walk, jump etc. algorithms that are aided by self-balancing during the course of the next months!

Here’s some sample code for doing this, in case anyone’s still looking. Quick function I wrote in a C++ Blueprint Function library to update the orientation target of a constraint’s angular motor. You can look up definition of “FindConstraitInstance” and should be able to call any of its set functions the same way I’m calling SetAngularOrientationTarget here.


Would this also allow changing a Bodies position at runtime as well?

EDIT:Not body but PxShape?