I discovered kinda by accident a quite good way to make it possible to pose a skeletal mesh, as well as less on accident how to save and load poses. This could potentially be useful for creator oriented game features.
View attachment 170824-044716.mp4
View attachment 170824-044520_web.mp4
Prerequisite: You gotta be able to click and drag physics objects (particularly skeletal mesh bones) in game, here's how you can do that.
Note: Your physics asset constraints control a lot of the posing (making sure limbs don't bend the wrong way and such) so having good constraints is pretty important for this to work right.
First you gotta enable ragdoll, and collisions for the mesh which are required for ragdoll to work:
Then you have to put all the physics simulating bones to sleep on event tick: (This is a very bad way of doing it, what you should instead do is open the physics asset of your mesh, and then make an array with the names of every bone that the physics asset is using, and then using that array instead of the get all socket names below)
That's about it for making the mesh poseable, because of how rigid body sleeping works, all the relevant bodies will wake as soon as they get any sort of physics interaction, but because we keep putting them back to sleep on every frame it creates this situation where we can drag the mesh around and pose it freely.
Then we need to be able to save and load poses, otherwise what would be the point, right?
Here's how I did that. First, in the animbp I create a reference for the skeletal mesh.
Then I create this event to save the current pose as a snapshot, this could also be done from the blueprint instead of animbp but since we're only ever going to be able to use the pose snapshot from inside animbp anyways, I figured I might as well make it do the work of saving it too.
Then in the animgraph this is how I switch between the currently saved pose and the default execution path, this is just as an example of course there's very little practical use in doing it this particular way (this is just proof of concept stuff). Note that I also created a bool to use as a toggle.
Then in the blueprint side of things I call the snapshot pose event when I want to save the pose
Then to display the saved pose like in the clip up top I load it like this:
To explain what it's doing, it disables the ragdoll (I do this because when we are in ragdoll mode with all physics bodies sleeping animation/poses will not work properly. If you don't wanna disable the ragdoll then you'd have to disable the sleeping on event tick stuff instead.
And that's it!
Tip: You may also want to save the mesh's world rotation, a least on the X and Y axes and load that too when you load a pose, this'll ensure your pose won't load crooked like in my example clips.
View attachment 170824-044716.mp4
View attachment 170824-044520_web.mp4
Prerequisite: You gotta be able to click and drag physics objects (particularly skeletal mesh bones) in game, here's how you can do that.
Note: Your physics asset constraints control a lot of the posing (making sure limbs don't bend the wrong way and such) so having good constraints is pretty important for this to work right.
First you gotta enable ragdoll, and collisions for the mesh which are required for ragdoll to work:
![24-08-131.png 24-08-131.png](https://attachments.f95zone.to/2024/08/thumb/3964299_24-08-131.png)
Then you have to put all the physics simulating bones to sleep on event tick: (This is a very bad way of doing it, what you should instead do is open the physics asset of your mesh, and then make an array with the names of every bone that the physics asset is using, and then using that array instead of the get all socket names below)
![24-08-132.png 24-08-132.png](https://attachments.f95zone.to/2024/08/thumb/3964306_24-08-132.png)
That's about it for making the mesh poseable, because of how rigid body sleeping works, all the relevant bodies will wake as soon as they get any sort of physics interaction, but because we keep putting them back to sleep on every frame it creates this situation where we can drag the mesh around and pose it freely.
Then we need to be able to save and load poses, otherwise what would be the point, right?
Here's how I did that. First, in the animbp I create a reference for the skeletal mesh.
![24-08-125.png 24-08-125.png](https://attachments.f95zone.to/2024/08/thumb/3964318_24-08-125.png)
Then I create this event to save the current pose as a snapshot, this could also be done from the blueprint instead of animbp but since we're only ever going to be able to use the pose snapshot from inside animbp anyways, I figured I might as well make it do the work of saving it too.
![24-08-126.png 24-08-126.png](https://attachments.f95zone.to/2024/08/thumb/3964321_24-08-126.png)
Then in the animgraph this is how I switch between the currently saved pose and the default execution path, this is just as an example of course there's very little practical use in doing it this particular way (this is just proof of concept stuff). Note that I also created a bool to use as a toggle.
![24-08-128.png 24-08-128.png](https://attachments.f95zone.to/2024/08/thumb/3964322_24-08-128.png)
Then in the blueprint side of things I call the snapshot pose event when I want to save the pose
![24-08-130.png 24-08-130.png](https://attachments.f95zone.to/2024/08/thumb/3964323_24-08-130.png)
Then to display the saved pose like in the clip up top I load it like this:
![24-08-133.png 24-08-133.png](https://attachments.f95zone.to/2024/08/thumb/3964331_24-08-133.png)
To explain what it's doing, it disables the ragdoll (I do this because when we are in ragdoll mode with all physics bodies sleeping animation/poses will not work properly. If you don't wanna disable the ragdoll then you'd have to disable the sleeping on event tick stuff instead.
And that's it!
Tip: You may also want to save the mesh's world rotation, a least on the X and Y axes and load that too when you load a pose, this'll ensure your pose won't load crooked like in my example clips.
Last edited: