ZBrushCentral

Turntable Zscript

Hi,

I wanted an easy way to view models in the round with minimal mouse effort, so I came up with this turntable zscript.

Press the button or SHIFT+‘R’, and your model will rotate around the apparent Y axis. Move the mouse, don’t click, to the right or left of the model and it will rotate in that direction. Also, the farther you move away from center screen, the faster the model will rotate. Press the mouse button to end the rotation.

Since there is a problem with gimbals lock when attempting to rotate around the actual Y axis, the model is temporarily turned on the x axis and rotated on the Z. After a minor blip, it will appear that the model is rotating on the Y. When you end the script, the model is rotated back.

One thing I couldn’t figure out the way I wanted, was to have the model remain in the orientation of where the turntable is stopped . This again seems due to the gimbals lock on Y–any number from-89 to 89 will leave the model upside down. so, for now I have it face forwards again.

If any of you Zscripters want to attack this issue or improve on this in any way, I’d certainly like to see it.

Otherwise, sit back, and admire your work as it spins before you.

Turntable.txt

hey this is awesome :slight_smile: Thanks a million ken! One thing though; do I have to load this text file through ZScripts? Or is there a way to have it in the zbrush folder and have it always active regaurdless of what zscript is loaded?

:cool:

You can cut and paste this text file into any Zscript you have. For example, I have this as a part of a bunch of script operations I like saved as the Default zscript. That way, it is loaded every time I start ZBrush

ok awesome :slight_smile: thanks for the tip Ken.

Hi Ken

I am at work so I can’t play around with this but look at the following code from my animation script that handles the flip you get with rotation values pass a certain point.

[VarSet,resultzr,IFrame * RotIncr] //Must trim down if greater than 180 [loop,10, [if,resultzr > 180, [VarSet,resultr,(resultr-180)-180] ,//else [LoopExit] ] ] //Must trim down if less than -180 [loop,10, [if,resultzr < -180, [VarSet,resultr,(resultr+180)+180] ,//else [LoopExit] ] ]

You might be able to adapt this logic to your script I don’t know. Basically in the code above

  1. I am adding an incremental value to an axis.
  2. If the rotation exceeds ± 180 degrees I massage the value so that it can continue without flipping.
  3. It is in a loop of 10 just in case the math doesn’t get the value under 180 degrees (10 is probably overkill)

Anyhoo, I hope this helps