PDA

View Full Version : vector expression problem?


ginodauri
09-12-2010, 02:09 PM
Hi
I have problem when using vectors in expression.
Same code with float arrays goes ok.
Problem is that objects disappear , attribute that is affected by expression gets some "strange" values like "10###0" or "inf" - something like that.



vector $novaPos;
vector $staraPos=$novaPos;
$novaPos=`xform -q -ws -t L_prednji`;
float $obimTocka=`arclen P_obimShape`;
float $distanca=mag($novaPos - $staraPos);
float $rotX=$distanca/$obimTocka*360;
vector $rot=`xform -q -ro -ws locator1`;
rotate ($rot.x) ($rot.y) ($rot.z) L_prednji;
float $rotA;
$rotA+=$rotX;
rotate -os -r ($rotA) 0 0 L_prednji;


Maybe xform command is making problem here(maybe some conversion from float to vector)??

ewerybody
09-13-2010, 02:41 PM
vector $novaPos; // you create the vector, should be <0, 0, 0>
vector $staraPos=$novaPos; // you copy it over to another one <0, 0, 0>
$novaPos = `xform -q -ws -t L_prednji`; // you put the world position of "L_prednji" in the 1st vector
float $obimTocka=`arclen P_obimShape`; // get length of P_obimShape
float $distanca=mag($novaPos - $staraPos); // you subtract <0, 0, 0> from novaPos vector, gets you distance from 0 0 0 to novaPos
float $rotX=$distanca/$obimTocka*360; // what?!? ...
vector $rot=`xform -q -ro -ws locator1`;
rotate ($rot.x) ($rot.y) ($rot.z) L_prednji;
float $rotA;
$rotA+=$rotX;
rotate -os -r ($rotA) 0 0 L_prednji;

darn your code is too specific. Could you please cook it down to the problem? So that one does not have to dig in this pile?! I mean... if you still want help... :/

I actually have very good experiences when fetching xform stuff into vectors.

CGTalk Moderation
09-13-2010, 02:41 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.