We are not worthy.
So this means our shape fills can have continuous shape effects too I guess.
I have a question regarding the crease lines, are they separate line shapes?
The multiple group/path thingo is also magic Vern, congrats.

Moderators: Víctor Paredes, Belgarath, slowtiger
I always believed that the bone's angle is the angle between the bone and its parent so it is the angle between the two bones.What I need to do is base movement along the path on the angle between the two bones. As the angle decreases and increases that is what should drive the motion.
let's study this hierarchy:The info I need is how to determine the angular relationship of the two bending bones. The "actual" angle not the "real" angle. Does this make sense? There must be a formula for determining the angle without taking into account say, a 895 degree rotation of one of the two bones.
Code: Select all
mod_360(Alpha)
do
if(Alpha >180)
Alpha = Alpha -360
if(Alpha<-180)
Alpha=Alpha+360
while (Alpha >180 or Alpha <-180)
return Alpha
With that you probably need to calculate the resulting percentage to a 100% modulus (or better to a [0,1] range. How did you called the amount value the is used to this function?:As for circular "360" rotations... that will be tricky because of the "winding". A bone can have any amount of rotation even like 700 degrees... it just keeps going around and around. It doesn't go back to zero when it gets around to the other side. I would have to do tricky calculations to figure out what the percentages would be. When it gets to the top it would "jump" to the end of the other side... it is possible and you are right it probably will be needed I just need to figure out the math.
EDIT: Circular path! Of course you said it Synth. Just one circular path for the whole thing. Make the transition point at the top and bottom segments. This might require a separate modification just for joints... hmmm... that's a good idea.
LM_Vector2 PointOnSegment(segID, percent)
Returns the location of a point on a segment.
Return value (LM_Vector2): a point located on the segment segID (int): a segment of the curve (starting with 0) percent (float): where on the segment to locate the point (from 0 to 1)
Code: Select all
mod_1(perc)
do
if(perc >1)
perc = perc -1
if(perc<0)
perc=perc+1
while (perc >1 or perc <0)
return perc
Code: Select all
function LayerScript(moho)
local layer = moho.layer
local mesh = moho:Mesh()
local skel = moho:ParentSkeleton()
local grpCnt = mesh:CountGroups()
if (mesh == nil) then
return
end
if(grpCnt == 0) then
return
end
if (skel == nil) then
return
end
local doitb = skel:Bone(0)
if(moho.frame == 0) then
--print("360 = "..math.rad(360))
--print("180 = "..math.rad(180))
layer.bpGroups = {}
local bone
local rBone
local boneCount = skel:CountBones()
for i = 0, boneCount -1 do
local b = skel:Bone(i)
local name = b:Name()
local pName = string.find(name, '.path')
if (pName) then
pName = string.sub(name, 1, -6)
rBone = b
layer.bpGroups[pName] = {}
layer.bpGroups[pName].bone = b
end
end
local tmpCrv
for i=0, grpCnt -1 do
local group = mesh:Group(i)
local pt = group:Point(0)
local selSeg = pt:Curve(0, 0)
local name = group:Name()
local subNamePath = string.sub(name, -5)
local subNamePoint = string.sub(name, -6)
local reverse = string.find(name, "reverse")
if (subNamePath == ".path") then
local tName = string.sub(name, 1, -6)
if(reverse) then
tName = string.sub(tName, 1, -9)
layer.bpGroups[tName].reverse = true
layer.bpGroups[tName].rCurve = selSeg
else
layer.bpGroups[tName].reverse = false
layer.bpGroups[tName].curve = selSeg
end
-- local pt = group:Point(0)
-- local selSeg = pt:Curve(0, 0)
-- layer.bpGroups[tName].curve = selSeg
end
if (subNamePoint == ".point") then
--local reverse = string.find(tName, "reverse")
local tName = string.sub(name, 1, -7)
local mvPt = group:Point(0)
if(reverse) then
tName = string.sub(tName, 1, -9)
layer.bpGroups[tName].rPoint = mvPt
else
layer.bpGroups[tName].point = mvPt
end
--local mvPt = group:Point(0)
--local tName = string.sub(name, 1, -7)
end
end
end
----
if(moho.frame > 0) then
for name in layer.bpGroups do
local rev = layer.bpGroups[name].reverse
local mvPt = layer.bpGroups[name].point
local selSeg = layer.bpGroups[name].curve
local segCnt = selSeg:CountSegments()
local bone = layer.bpGroups[name].bone
local rotation = (bone.fAnimAngle:GetValue(moho.frame)) / math.rad(180)
if(rev == true) then
if(rotation <0) then
mvPt = layer.bpGroups[name].rPoint
selSeg = layer.bpGroups[name].rCurve
segCnt = selSeg:CountSegments()
rotation = rotation * -1
--pt = selSeg:PointOnSegment(0, rotation*segCnt)
end
else
if(rotation > 0) then
rotation = (bone.fAnimAngle:GetValue(moho.frame)) / math.rad(180)
--pt = selSeg:PointOnSegment(0, rotation*segCnt)
end
end
local pt = selSeg:PointOnSegment(0, rotation*segCnt)
local tmpCrv = 0.3 - (0.3*rotation)
mvPt:SetCurvature(tmpCrv, 1)
for i = 1, segCnt do
local sp = i-1
if(rotation > i/segCnt) then
pt = selSeg:PointOnSegment(i, (rotation*segCnt)-i)
end
end
mvPt.fPos = pt
doitb.fPos = pt
skel:UpdateBoneMatrix()
end
end
end
Code: Select all
math.mod(Alpha, 360)
Code: Select all
function mod_360(Alpha)
Alpha = math.deg(Alpha)
local pcnt = 1/180
if (Alpha < -180) then
Alpha = Alpha + 360
elseif (Alpha > 180) then
Alpha = Alpha - 360
end
Alpha = math.mod(Alpha, 180)
Alpha = Alpha * pcnt
if (Alpha < 0) then
Alpha = Alpha * -1
end
return Alpha
end