On 27/03/2013 at 04:54, xxxxxxxx wrote:
Matrix maths is still not my favorite topic.
I can't get this to work properly. I want to emulate the Axis Mode in Cinema, a function that
moves the object's axis to a specific point (and rotation) without changing the polygon-object's
points and children's global position (and rotation). It won't work properly, see this video.
Can someone pls point out what's wrong or maybe even explain how to do it?
> import c4d
> def move_axis(obj, new_matrix=c4d.Matrix()) :
> mat = obj.GetMl() * new_matrix
> if obj.CheckType(c4d.Opoint) :
> points = obj.GetAllPoints()
> for i, p in enumerate(points) :
> obj.SetPoint(i, p * mat)
> for child in obj.GetChildren() :
> child.SetMl(child.GetMl() * mat)
> def main() :
> if not op:
> doc.AddUndo(c4d.UNDOTYPE_CHANGE, op)
Edit: Video comes in a few seconds.