Page 1 of 1
world angle of bone?
Posted: Mon Nov 15, 2021 11:23 am
by davoodice2
hi?
how can i achieve that?
Re: world angle of bone?
Posted: Mon Nov 15, 2021 11:45 am
by hayasidist
2d case : i.e. no rotation about x/y
for a root bone (i.e. one without a parent) bone.fAngle is absolute; for a child bone bone.fAngle is relative to its parent so (e.g.) two bones - one root, one child - pointing down will have angles 270 and 0 respectively.
those are relative to the layer; so if (e.g.) the layer is rotated in z by (say) 90 then bone.fAngle is unchanged, but the bone will be pointing to the right - i.e. world 90+270 (or that mod 360 = 0)
Re: world angle of bone?
Posted: Mon Nov 15, 2021 1:11 pm
by davoodice2
hayasidist wrote: ↑Mon Nov 15, 2021 11:45 am
2d case : i.e. no rotation about x/y
for a root bone (i.e. one without a parent) bone.fAngle is absolute; for a child bone bone.fAngle is relative to its parent so (e.g.) two bones - one root, one child - pointing down will have angles 270 and 0 respectively.
those are relative to the layer; so if (e.g.) the layer is rotated in z by (say) 90 then bone.fAngle is unchanged, but the bone will be pointing to the right - i.e. world 90+270 (or that mod 360 = 0)
that means I must calculate sum of all rotations ?
is there shortway? or function?
and how to define a vector that doesn't start from 0,0
Re: world angle of bone?
Posted: Mon Nov 15, 2021 3:30 pm
by hayasidist
depends what you're trying to do ... you might find that a bone transform matrix (fRest or fMoved) will do what you want -- or you might find it makes sense to use a Matrix to accumulate the rotations and translations.
as for vectors that don't start from {0,0} ... well at the risk of totally misunderstanding what you're thinking here ... an LM_Vector2 has an x value and y value, so if you want your vector to start at {X0, Y0} and go to {X1, Y1} you can store those two vectors exactly like that - or if you have a vector that is {dX, dY} wrt {0,0} then X1=X0+dX, Y1=Y0+dY - either store dX,dY and remember to add - or add and store the result
Re: world angle of bone?
Posted: Mon Nov 15, 2021 3:42 pm
by davoodice2
hayasidist wrote: ↑Mon Nov 15, 2021 3:30 pm
depends what you're trying to do ... you might find that a bone transform matrix (fRest or fMoved) will do what you want -- or you might find it makes sense to use a Matrix to accumulate the rotations and translations.
as for vectors that don't start from {0,0} ... well at the risk of totally misunderstanding what you're thinking here ... an LM_Vector2 has an x value and y value, so if you want your vector to start at {X0, Y0} and go to {X1, Y1} you can store those two vectors exactly like that - or if you have a vector that is {dX, dY} wrt {0,0} then X1=X0+dX, Y1=Y0+dY - either store dX,dY and remember to add - or add and store the result
thanks. i will some test . i'll come back with more questions
