ZBrushCentral

Question: Trying to rotate at multiple azimuths

Hi, I’m trying to record a script (but I’m willing to write it) that will rotate an object and all it’s subtools 18 degrees to the left, render the image and save it. It will repeat the process 19 times to complete a rotation. Now comes the tricky part. I want to drop it 9 degrees on the y axis and go around again. You know what i’m gonna say next. GYMBAL LOCK. Is there a way to translate this so i can type in precise incriments?

This is so I can produce 400 or so images of an object to be used with a macromedia flash utility that allows you to click and drag to “rotate” an object.
I’m trying to do 19 frames around 19 azimuthal levels.

Obviously I can’t use a Zscript to record a Zscript, but if I could get help on how to write it, I would appreciate it.

You can set the rotation of an object on the canvas by switching on Rotate (with Edit off, so that the Gyro is visible) and then entering values in the Transform:Info sliders. In zscripting, the same can be done using the TransformSet command.

Although you can write a zscript to do what you want, gimbal lock will be a big problem. Whilst avoiding precise 90 degree positions by adding a small amount such as .01 will help, I’ve not found a reliable method for all situations.

You can save yourself a lot of bother if you can use the built in Movie palette. If you have Quicktime Pro you can export an image sequence from the resulting movie. All that’s needed then is to set up the Movie palette options to record the required number of frames and then run a script like this:

[IButton,AdjustX,,
	//first set model to default position
	[TransformGet,xPos,yPos,zPos,xScale,yScale,zScale,xRotate,yRotate,zRotate]
	[TransformSet,xPos,yPos,zPos,xScale,yScale,zScale,0,0,0]
	//then repeat turntable, adjusting X for each revolution		
	[Loop,20,
		[If,([IGet,Transform:Info:Y Component]>=-90)&&([IGet,Transform:Info:Y Component]<=90),
			[ISet,Transform:Info:X Component,[IGet,Transform:Info:X Component]-9]
			,
			[ISet,Transform:Info:X Component,[IGet,Transform:Info:X Component]+9]
		]
		[Delay,.1]//just for checking adjustment	
		[IPress,Movie:Turntable]
	]
]

EDIT: The above script needs the Rotate Gyro showing to work. It won’t show in the movie.

Thanks, that is helpful. I don’t own Quicktime pro, But I think windows movie maker allows you to import quicktime format. If not I will have to find a way to fudge it by offseting it by one degree like you said and come up with a repetitive process that takes the gymbal effect into account. I plan to use this with a large number of models and would like it to be as automatic as possible. I own a tattoo studio in Lakewood, Co. and I’m trying to create an ultimate interactive referance of tattoo style imagery.

www.primitivesoultattoo.com
www.myspace.com/primitivesoultattoo

Another approach is to use the Tool: Deformation: Rotate slider. The drawback with this is that the adjustment has to be made to every subtool, so it is slow but it does avoid having to grapple with gimbal lock. Also, as the actual mesh orientation is changed, make sure you back up the model first.

This script shows the method. It will pretty much do what you want, and I’ve included comments so you can see how to adjust things if you wish. Note that the image is exported while the last subtool is selected. To avoid the ‘unselected subtools are darker’ issue you need to fill all subtools with white - that’s if you’re not using polypainting.