THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/11/2012 at 13:06, xxxxxxxx wrote:
It sounds like something simple, but I'm not able to do it in Python.
I have e.g. a plane I want to rotate, not from the center, but from a specific side.
So, I need to change the object axis.
On 10/11/2012 at 14:30, xxxxxxxx wrote:
I think you can do it by change the position of the object and all his points to keep their global position.
Here is a little code that I did one day for it :
from c4d import Vector, Matrix
def axe(objet, matrice, relatif = True) :
if relatif : m_obj = objet.GetMl()
else : m_obj = objet.GetMg()
m = ~matrice * m_obj
nbpts = objet.GetPointCount()
points = objet.GetAllPoints()
for i in xrange(nbpts) :
points[i] = m.Mul(points[i])
if relatif : objet.SetMl(matrice)
else : objet.SetMg(matrice)
def main() :
if not op : return
if op.GetType() != c4d.Opolygon : return
v_1 = Vector(0, 1, 0)
v_2 = Vector(0, 0, 1)
v_3 = Vector(1, 0, 0)
dep = Vector(0, 50, 0)
mat = Matrix(dep, v_1, v_2, v_3) # Nouvelle matrice
The variable mat is the new matrix who affect op.
On 11/11/2012 at 04:33, xxxxxxxx wrote:
Amazing, wonderful clever solution!
Thanks very much.