Forum: Poser Technical


Subject: More Poser secrets revealed - Don't read...

VK opened this issue on Oct 27, 2003 ยท 33 posts


VK posted Mon, 27 October 2003 at 10:08 AM

Attached Link: arrowprop.zip (4 KB)

The above formulas are very handy, once you know, where you want to move the variable origin. But when you test many different origin settings, you have to calculate and adjust the channel values again and again. Sooner or later, this will become an annoying task, even if you are a very patient being. Fortunately, the formulas are simple enough, so we can use ERC code, and let Poser calculate the values and adjust the channels. The picture shows the channel scheme for the arrow example. The code is made of the same Center channels again. I have added ERC slave-code for the CenterB channels, and some more channels, to evaluate sine and cosine of the zRotateA value. This time, the yCenterA channel is the ERC master. When you work with the model, you can set the yCenterA dial, to move the variable origin along the y axis, and create different rotation centers for the zRotateB rotation. Note that yCenterA moves in the "wrong" direction: Negative yCenterA values lift the origin. Positive yCenterA values lower the origin. To make a more user-friendly interface, you can add an extra master dial, and slave yCenterA to the new master, specifying deltaAddDelta -1. Thanks to the "new" valueOperators (valueOpPlus etc.), we can write code to evaluate sine and cosine of zRotateA. As the algorithm calculates with radian values, the value of zRotateA (degrees) is converted to radian. Then sine and cosine are evaluated. The code needs 20 channels (not shown in the picture). Finally, the xCenterB slave is set to yCenterA * sin(rad(zRotateA)), and the yCenterB slave to -yCenterA * cos(rad(zRotateA)). You can download the example arrowprop.zip (4 KB) to test the code. Use dial "zrotA" (channel zRotateA) to rotate around the Poser origin. Move dial "SetOrigin" at any time, to choose a new origin. "SetOrigin" is the master of yCenterA. Once you have set the preexisting zRotateA rotation, and the new origin, you can use dial "zrotB" (channel zRotateB), to rotate around the new origin. This version of the code can be used for -90 < alpha < 90, i.e. zRotateA can be set between -90 and 90. If you want an automatic variable origin for a wider range of alphas, you need more code.