PDA

View Full Version : Looking for exact syntax for rotation attributes


maddav99
11-27-2006, 09:53 PM
I want to use the setAttr to rotate an object, but I want it to be added to the existing rotation. What I had in mind was-

setAttr pSphere1.rotateX + getAttr pSphere1.rotateX;

which is, obviously, wrong. What is the right way to write this?

ntmonkey
11-27-2006, 10:48 PM
float $currentRot = `getAttr pSphere1.rotateX`;
setAttr pSphere1.rotateX ($currentRot * 2);

Is this what you want?

-Lu

StephG
11-28-2006, 06:44 AM
How about:

setAttr pSphere1.rotateX (`getAttr pSphere1.rotateX` * 2);

I'm a believer in variable conservation ;)

ntmonkey
11-28-2006, 07:59 AM
setAttr pSphere1.rx (`getAttr pSphere1.rx` * 2);

Even less typing. :scream:

Lu

Sick Spider
11-28-2006, 06:03 PM
Now for the longer way:



global proc findRotation()
{
float $rotation = `getAttr pSphere1.rx`;
int $byX= `intField -q -value "xBy"`;
float $newRot = ($rotation*$byX);
text -e -label ("New X will be = "+$newRot) "printMe";
}
global proc rotationInfoUI()
{
string $rotUI = "rot";if (`window -exists $rotUI`) deleteUI -window $rotUI;
window -widthHeight 150 220 -title "Rotation" $rotUI;
columnLayout -adjustableColumn 1;
button -label "find" -c "findRotation";
text -label "By:";
intField -minValue 0 -maxValue 1000 -value 2 "xBy";
text -label "pSphere RotationX is: ";
text -label "" "printMe";
window -e -widthHeight 150 150 $rotUI;
showWindow;
}rotationInfoUI;




:shrug:
Thank god to the "Copy" "Paste" options. lol..

CGTalk Moderation
11-28-2006, 06:03 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.