View Full Version : speed of rotation

08 August 2008, 03:03 PM
i am creating a GUI to control a gun

so i want a slider that controls the speed of rotation on z axis.

so u move the slider to set the speed and the object will keep turning until u change the speed.
i want it to be an interger value

int $Time = `currentTime -q`; //make a variable of $Time and assigns the of frame number
int $Amount = value of slider * 2// not sure how to link * to make higher
foat $Value = $Time + $Amount; //takes variable $Time and adds by amount
//so it has a higher value
connectAttr "frontGunGroup.rz" $Value; //connect the variable with the .rz
//value but not sure if this is working
intSliderGrp -l "Rot /sec" -field true -step 1
this is where i get stuck, i dont know how to link it all together and make that control the speed.

also i have this
if ((frontGunGroup.rz % 90) == 0)
bulletEmitter.rate = 25;
//this should mean a particle is emitted when the rotation value is a multiple of 90 but it
//just stays at 25 (im working in 25fps) all the time.


08 August 2008, 05:13 PM
i have solved the rotation problem, there is prob a quicker way but this works

i added 2 new attr to the group Rate and Amount

rotateZ has this expression .rz = .Rate *20;

rate has this expression .Rate = .Amount * time;

if (`window -exists GunControl`)
deleteUI GunControl;

window -menuBar true -widthHeight 400 300 -title "Gun Control" GunControl;

intSliderGrp -label "Rotation /Sec" -field true -step 1 -dc "setAttr frontGunGroup.Amount #1";

showWindow GunControl;

UI contols the speed of rotation.

all i need to do now is set the particles so they emit every 90 degres of rotation

not sure how to do this now

CGTalk Moderation
08 August 2008, 05:13 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.