Karnageddon
07-14-2009, 03:55 AM
Hello again,
Part of my ongoing project involves a circular saw that will be turned on/off, on several occasions throughout the short. What I've done is set up a custom slider in the scene that works on a expression where "if the value of the slider is beyond 50%, then the saw will rotate in a continuous loop using an expression involving MOD". The reason for this is so that I can control the speed of the rotation through the mod value and force it to rotate continuously in real time which is working perfectly. Now I'm taking it a step further and creating a separate window interface that will control the two dozen functions of this robot that I have so far, thus saving the trouble of constantly moving the viewport, zooming in/out and taking up valuable space, every time i need to get to the controllers.
What I've done now is set up a checkbutton on the interface that allows me to turn the slider to 100% and back to 0% and this works great, but now here is where the problem comes in: I need to know how to store the blade's end rotation degree value, the reason for this is because when I stop the saw, the slider jumps back to 0% and the blade jumps back to its 0% rotation value, so when motionblur is applied you get a very heavy blur for the last few frames. The reason is because this blade will continue rotating towards infinity, so when i decide to stop it after a while; say after it gets to about -60000 X value rotation and all of a sudden jumps back down to it's default 150 X value rotation, it causes the heavy blur.
So I basically need to know how to store it's last X rotation degree, so that it stops rotation at the point I made it stop instead of reverting back to default, and when i run it again, it continues from its end position.
Here's what I have for the expression controlling the looping rotation of the blade.
if(SpinLoop>.5,mod(NT*-400,6.25),0)
Simplified
"SpinLoop" is the variable for the slider that enables/disables the reloading loop i mentioned above
-400=Rotation Speed
6.25=Rotation Limit (full 360 rotation according to my calculations)
And this is the maxscript I am working on(simplified with just the current issue)
Note: Arc08 is a dummy that controls the X rotation of the blade.
C.Saw Controller-spin loop is the full path for the slider that I used the variable for above. I chose to go with its local position to turn it on/off rather than percent.value.
macroScript CanBot Controller Interface category:"My Tools"
(
rollout window "CanBot" width:250 height:100
(
groupBox grp1 "On/Off" pos:[5,5] width:240 height:90 enabled:true
checkButton ckb1 "Saw Rotation Toggle" pos:[57,26] width:136 height:48 highlightColor:(color 0 255 0)
on ckb1 changed state do
if state== on then
move $'C.SAW Controller-Spin Loop' [123.843,0,0]
else
move $'C.SAW Controller-Spin Loop' [-101.886,0,0]
rotate $Arc08 (angleaxis 181 [0,0,1])
)
createDialog window width:250 height:100
)
If I did not explain this clearly, please let me know and I'll try my best to rephrase it.
Part of my ongoing project involves a circular saw that will be turned on/off, on several occasions throughout the short. What I've done is set up a custom slider in the scene that works on a expression where "if the value of the slider is beyond 50%, then the saw will rotate in a continuous loop using an expression involving MOD". The reason for this is so that I can control the speed of the rotation through the mod value and force it to rotate continuously in real time which is working perfectly. Now I'm taking it a step further and creating a separate window interface that will control the two dozen functions of this robot that I have so far, thus saving the trouble of constantly moving the viewport, zooming in/out and taking up valuable space, every time i need to get to the controllers.
What I've done now is set up a checkbutton on the interface that allows me to turn the slider to 100% and back to 0% and this works great, but now here is where the problem comes in: I need to know how to store the blade's end rotation degree value, the reason for this is because when I stop the saw, the slider jumps back to 0% and the blade jumps back to its 0% rotation value, so when motionblur is applied you get a very heavy blur for the last few frames. The reason is because this blade will continue rotating towards infinity, so when i decide to stop it after a while; say after it gets to about -60000 X value rotation and all of a sudden jumps back down to it's default 150 X value rotation, it causes the heavy blur.
So I basically need to know how to store it's last X rotation degree, so that it stops rotation at the point I made it stop instead of reverting back to default, and when i run it again, it continues from its end position.
Here's what I have for the expression controlling the looping rotation of the blade.
if(SpinLoop>.5,mod(NT*-400,6.25),0)
Simplified
"SpinLoop" is the variable for the slider that enables/disables the reloading loop i mentioned above
-400=Rotation Speed
6.25=Rotation Limit (full 360 rotation according to my calculations)
And this is the maxscript I am working on(simplified with just the current issue)
Note: Arc08 is a dummy that controls the X rotation of the blade.
C.Saw Controller-spin loop is the full path for the slider that I used the variable for above. I chose to go with its local position to turn it on/off rather than percent.value.
macroScript CanBot Controller Interface category:"My Tools"
(
rollout window "CanBot" width:250 height:100
(
groupBox grp1 "On/Off" pos:[5,5] width:240 height:90 enabled:true
checkButton ckb1 "Saw Rotation Toggle" pos:[57,26] width:136 height:48 highlightColor:(color 0 255 0)
on ckb1 changed state do
if state== on then
move $'C.SAW Controller-Spin Loop' [123.843,0,0]
else
move $'C.SAW Controller-Spin Loop' [-101.886,0,0]
rotate $Arc08 (angleaxis 181 [0,0,1])
)
createDialog window width:250 height:100
)
If I did not explain this clearly, please let me know and I'll try my best to rephrase it.
