While I am still interested in the math behind Targeting and Pole Vectoring (It must be an interesting solution...), I came up with a rather simple solution to my problem...
I thought, Lightwave already does the computations, is there any way I can set the target and pole, get the values, and reset them, and not cause things to flicker and flip around? As a matter of fact, there is...
Code:
SelectItem(my_obj.id);
if(targ){
//Turn On the Target, if we have one...
TargetItem(targ.id);
HController(2);
PController(2);
TargetItem(targ.id);
}
if(pole){
//Turn On the Pole, if we have one...
PoleItem(pole.id);
BController(6);
PoleItem(pole.id);
}
//Update Motions, but do not refresh screen
UpdateMotion();
//Grab the computed H,P,B rotations!
tv = my_obj.getRotation(time);
if(targ){
//Turn off the target
TargetItem(0);
HController(1);
PController(1);
}
if(pole){
//Turn Off the pole
PoleItem(0);
BController(1);
}
Does it quite nicely, without mucking around in all that trig and vector math. You do have to remember to re-select whatever object you're manipulating before you exit the process UDF, but it works! ~yay!~
Bookmarks