Forum: Poser Python Scripting


Subject: Moving morphs between different figures

Cage opened this issue on Dec 20, 2006 · 1232 posts


Spanki posted Tue, 25 March 2008 at 12:25 AM

... in fact, the code that generates the above values is:

--- snip ---
intersection_distance = ( tp.plane - ndotv ) / ndota   # refer to the clasic code to find similar

hp.HitDist = intersection_distance

hp.HitPoint = origvert.project( origvertnormal, intersection_distance )

hp.HitDelta = hp.HitPoint - origvert

--- snip ---

...the normal is a "unit vector" meaning that it's value = 1.0 (it's like multiplying by 1.0, but "in some direction") and the intersection_distance is just true distance, but with a sign, so it can flip the normal's direction from positive to negative when it gets multiplied by it in the project().   Don't let the sign confuse you, it just means:

if hp.HitDist < 0.0:<br></br>
   the_intersection_is_towards_the_center()   #
must shrink to get there<br></br>
else:<br></br>
   the_intersection_is_away_from_the_center()  #
must inflate to get there<br></br>

Cinema4D Plugins (Home of Riptide, Riptide Pro, Undertow, Morph Mill, KyamaSlide and I/Ogre plugins) Poser products Freelance Modelling, Poser Rigging, UV-mapping work for hire.