Hi,
i tried to calculate the easin and easeout of a bendy bone to match a bezier curve based on this blog post
In the post is a calculation formula mentioned
hlength1 = ease_in * length * 0.390464f
hlength2 = ease_out * length * 0.390464f
but i am not able to achieve a match between bendy bone and the curve.
Anyway here is the script to test the result and hopefully someone can point me in the right direction to get a correct result and show me where my fault is.
import bpy
# try to match bezier curve
armature = bpy.data.objects['Armature']
bendy_bone = armature.pose.bones['bendy_bone']
start_handle = armature.pose.bones['h1']
end_handle = armature.pose.bones['h2']
# get custom bendy_bone handle
v1 = start_handle.head
v2 = start_handle.tail
v3 = end_handle.head
v4 = end_handle.tail
hlength1 = start_handle.length
hlength2 = end_handle.length
length = bendy_bone.length # or (v2-v3).length ?
# https://aligorith.blogspot.com/2016/05/an-in-depth-look-at-how-b-bones-work.html
# hlength1 = ease_in * length * 0.350464f
# hlength2 = ease_out * length * 0.350464f
# tried to calculate easein and -out
ease_in = hlength1/(length*0.390464)
ease_out = hlength2/(length*0.390464)
bendy_bone.bbone_easein = ease_in
bendy_bone.bbone_easeout = ease_out
# match bezier handle to bendy_bone handle
bezier = bpy.data.objects['BezierCurve'].data.splines[0]
bezier.bezier_points[0].co = v1
bezier.bezier_points[1].co = v4
bezier.bezier_points[0].handle_right = v2
bezier.bezier_points[1].handle_left = v3
Here is the blend test file with a simple setup just scale the bendy bone handles and run the script.
bendy_curve_test.blend (786.3 KB)