To cut a long story short since I have been working on this one thing for a very long time, I basically have a skeletal mesh that I have turned into a physics actor. I am happy with the physics actor and it works correctly as it is. I would, however, like to change the scale of the skeletal mesh / physics actor dynamically during runtime.
For some example context, I am working on making a modular character creation system and would like to have a set of different tails that players can add to their characters. As a part of the creation interface, there is a slider that will allow you to adjust the tail length, and as you move the slider, the length of the tail will update in the game. This needs to be a physics asset since I would like it to dynamically react to how the character moves and hit or knock over things in the environment. It is very important that the scaled mesh collides with things and moves correctly.
In attempting to simply apply scaling length to test tail through the character blueprint by pressing some debug keys, I am able to scale the mesh along the axis I specify. However, the mesh is the only thing that scales; the skeleton and physics do not scale with it. For example, the default tail length will sway and collide with the environment as it should, but a longer tail that was scaled will clip through the environment and only collide with things where the default tail length would be. In addition to this, the tail mesh becomes distorted.
How am I able to scale the skeleton and or physics actor along one axis so that it behaves as it should? I am using blender to create my models. Am I able to do something similar to using morph targets / shape keys to distort the skeleton? Can I keyframe bone size somehow? Am I able to lerp in between two target skeletons?
Thanks to anyone in advance who offers some help; it is greatly appreciated!
I am able to adjust the scale of the bones in the skeleton by using an animation blueprint and the transform bone node in the Anim Graph. All appears to be working correctly in that sense, however, the physics actor’s collision bodies don’t update. In essence, the new scaled mesh distorts how it should in relation to physics reactions, but I still have the problem of the end of the tail clipping through the environment; the physics bodies do not scale directly with the bones.
My problem is resolved with skeletal scaling, but now I need to find a way to recalculate the physics bodies to scale with the bones.
Not in regards to recalculating the physics bodies, no. I have done work in modifying the model in the correct way that I would like for it to be manipulated using multiple transform(modify)bone nodes in Anim Blueprints for the skeletal meshes to calculate believable scaling. Documentation on the node used can be found here.
I noticed something with this method though and how using physics blend weights actually doesn’t update the character’s tail’s rigidity. By using the command “pxvis collision” during runtime, you’re able to visualize the collision in your world. The tail actually is just a floppy noodle; the actual skeleton is being updated based on the positioning of the physics actor meaning that if you were to hit the empty space under a character, their tail would react whereas a hit to where you visibly see the tail would do nothing to the physics asset.
This means that there is a problem with doing this and using blend weights to determine how a physics actor should move. I’ll need to find another method for doing this, since dynamic rigidity and correct collision are a must have for my game. Work has been a little slow on my end, but if I come across something, I’ll remember to post it here. No saying when that’ll be though; I am also working on a lot of other things in relation to developing my game at the same time, and not to mention real-world stuff.
I’ll keep this updated when I come across something.
This is an old thread, but I ran into this problem (although I was scaling my mesh in all axes), and calling RecreatePhysicsState() (native method) on the SkeletalMeshComponent before calling SetSimulatePhysics did the trick for me.