Notifications
Clear all
[Closed] Twist Bones
Apr 10, 2018 10:03 am
This is an old question, but I didn’t find a solution yet, any trick to create twist bones that don’t flip at angle greater than ±180? I know the logic is true, quaternion will flip at -+180 and we need to use rotation stored in the rotation controller, but controller wouldn’t be updated if we rotate the parent or other effected objects, any idea?
1 Reply
Apr 10, 2018 10:03 am
I have an idea, what about storing rotation(X) in attribute , then wiring to that attribute instead of current rotation. this is my first try:
clearlistener()
with redraw off
(
delete objects
Obj = teapot()
TargetA = teapot pos:[100,0,0]
CA = attributes "RigTracks"
(
parameters parameterBlock rollout:parameterBlockUI
(
LastX type:#float ui:LastXUI
NewX type:#float ui:NewXUI
)
rollout parameterBlockUI "Bend"
(
spinner LastXUI "OldX:" range:[-1e9,1e9,0]
spinner NewXUI "NewX:" range:[-1e9,1e9,0]
)
)
Md = EmptyModifier name:"CutAttributes"
addmodifier TargetA Md
custattributes.add Md CA
Md.RigTracks[#LastX].controller = bezier_float()
Md.RigTracks[#NewX].controller = bezier_float()
RS = rotation_Script()
RS.addnode "TargetA" TargetA
RS.addobject "LastX" Md.RigTracks[#LastX]
RS.addobject "NewX" Md.RigTracks[#NewX]
RS.script =
"
fn GetX Rot =
(
r = quattoeuler Rot order:7
r.x+r.z
)
x1 = GetX TargetA.rotation
if x1 < 0 do x1+=360
deltaX = abs(x1 - LastX.value)
if x1 < LastX.value do deltaX = -deltaX
NewX.value += deltaX
LastX.value = x1
quat (NewX.value/2) [1,0,0]
"
Obj.rotation.controller = RS
select TargetA
)
above code is not completed and has some bugs, but kinda shows my idea.