PDA

View Full Version : Error


arunspooja
05-13-2006, 09:11 AM
Good Afternoon

I have made a wheel and if I move the wheel in x direction it should rotate and if the scale is uniform it will align accordingly (to the plane, created as a base or on the grid) . And if the scale is not uniform it will show a error message.

I have written a script for the above but in that all works fine but when the scale is not uniform its not executing the else part.

I cant see the error message.

If you find the solution reply



float $scalex= `getAttr tire.scaleX`;

float $scaley= `getAttr tire.scaleY`;

float $scalez= `getAttr tire.scaleZ`;

float $pi= 3.141592;

float $deg=360;

float $travel=`getAttr tire.ty`;

if(($scalex==$scaley)&&($scaley==$scalez))

{

if($scalex!=$travel)

{

tire.translateY=$scalex;

}

tire.rotateY=-(tire.translateZ*(($deg)/(2*$pi*$scalex)));

}

else

{

error "scale should be uniform";

}

Thankyou

Robert Bateman
05-13-2006, 12:50 PM
don't use == or != to test equality of floats. It rarely works.

if( (abs($sx-$sy) + abs($sz-$sz)) < 0.001 )
{

}

tciny
05-13-2006, 01:30 PM
I'd recommend floatEq...
if( floatEq($scalex, $scaley) )

CGTalk Moderation
05-13-2006, 01:30 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.