I'm trying to create an IK Spline Tag with an existing spline/curve object.
The problem is whenever I run the code, the spline interpolation is replaced.
You can see an illustration video of the problem here:
You can check the illustration file here:
Is there a way around this?
Thank you for looking at the problem.
Here is the code I used:
def list_children(obj, withParent=1):
objList = [obj]
objList = 
for kid in obj.GetChildren():
objList += list_children(kid)
spine_chain = list_children(doc.SearchObject("spine01_jnt"))
start_ikHandle = c4d.BaseObject(c4d.Onull)
start_ikHandle.SetName( (spine_chain.GetName()) + "_ikHandle" )
end_ikHandle = c4d.BaseObject(c4d.Onull)
end_ikHandle.SetName( (spine_chain.GetName()) + "_ikHandle" )
spine_crv = doc.SearchObject("spine_crv")
# Create IK Spline tag
ikSpline_tag = spine_chain.MakeTag(1019862)
ikSpline_tag[c4d.ID_CA_IKSPLINE_TAG_SPLINE] = spine_crv # error in this. it changes the curve.
ikSpline_tag[c4d.ID_CA_IKSPLINE_TAG_END] = spine_chain
ikSpline_tag[c4d.ID_CA_IKSPLINE_TAG_TYPE] = c4d.ID_CA_IKSPLINE_TAG_TYPE_EQUAL
# Add IK handles
ikSpline_tag = start_ikHandle
ikSpline_tag = end_ikHandle
Kindly ignore the query above.
I think this is more of a rigging question rather than a coding questing.
Anyhow, in the IK spline tag, if you set the align and aim axis to X rather than default Z.
And set the offset from 10cm to like 50cm.
It should work more or less as expected.
Hi @bentraje, since you rotate the axis (with SetMg) you also need to update the tangents according to the correct axis since tangents are in local space of points positions which are also in local space of the object.
But as you figured is more rigging than a programming issue. And if you already solve the issue congratz!