Hi,
I wanted to implement “Spring Bone” in Flax.
Basically is a script to move specific bones (usually hair) to bounce/swing like a joint constraint.
For example this asset in Unity :
I am not looking for assets, because I used to write my own code to move the bone manually.
That way I can have specific parameters that will feed my needs in my game.
In Unity, the bones are represented by an object (Actor in Flax) and can be seen in the Hierarchy
So moving these bones is straightforward, you just select the Object and move its Transform.
My question is, how can you “edit/move/influence” bones in Flax?
The closest thing I can find is in this IK tutorial , where you move the bone inside AnimGraph
But that only works because
- most of the computation is done by script (outside of AnimGraph) and we only pass parameter value to AnimGraph parameters to move the bone. (we only do “write/set” process towards AnimGraph)
- IK bones tend to have small amount (e,g : left foot, right foot, left hand, right hand)
Meanwhile, in Spring bone, there are some problems that is a bit different than IK :
-
I need to cache and check the current position/rotation of specific bone ( “get/read” process)
so this is the solution I came up with
I call “AnimatedModel.GetNodeTransformation()” and then process it in custom Script,
then set the result into “AnimGraphParameter” to affect that specific bone.
Is this the correct way? or are there more direct approach? -
The AnimGraph will be very occupied with many nodes. Because in spring bone you need to move/edit all joints of the constraints (hair_root → hair1 → hair2 → hair_end)
And this will increase, if you have more bones to simulate (like tails, accessories, etc)
Can someone or the dev, point me in the right direction to how to edit/affect bones for AnimatedModel properly in Flax?
Thank you.