Forum: Poser Python Scripting


Subject: Moving magnets...

Josiah opened this issue on Nov 16, 2002 ยท 5 posts


Josiah posted Sat, 16 November 2002 at 2:57 PM

Ok, here I am again; I create a ball prop, then I run this script on it. The center of the magnet base should move to the vertex defined as "vert" (the ball prop has 162 verts). The problem is, it dosent seem to work! I use the print statments to show the mag bases before and after origin, and it DOES move! Something screwy with the coordinate systems I am using, do I need to get the verts coordinates in another way, such as "world"? How can this be done? #################################### scene = poser.Scene() actor = scene.CurrentActor() geom = actor.Geometry() vert = geom.Vertex(100) # vertex no. 100 scene.CreateMagnet() actor = scene.Actor("Mag Base 1") print "before origin", actor.Origin() actor.SetOrigin(vert.X(), vert.Y(), vert.Z()) print "after origin", actor.Origin() scene.DrawAll() #################################### Thanks once again to the wise sages of this forum for any help they might be able to provide! josiah


ockham posted Sat, 16 November 2002 at 4:17 PM

You're beyond my territory here! One thing you might try: just before DrawAll, use GeomChanged() on all the actors you've affected.

My python page
My ShareCG freebies


ockham posted Sat, 16 November 2002 at 4:17 PM

Oops, I mean MarkGeomChanged().

My python page
My ShareCG freebies


Josiah posted Sat, 16 November 2002 at 8:30 PM

Ok, I found that the origin was moving correctly, but the "origin of an object is not it's location in 3d space but a reference to its own center! So by moving the origin, I am just moveing the point about which transforms occur, not the object itself!


ockham posted Sun, 17 November 2002 at 11:50 AM

Try WorldDisplacement instead of Origin. In my experience, W-D gives the proper actual position for most things.

My python page
My ShareCG freebies