Home Technical Talk

Centre To World In Maya Problem - Fix

Apologies for the new thread, but for some reason I couldn't add a reply to original posters thread

Hi,

I wrote a script to help you with this problem, copy and paste into your script editor and then drag to a shelf if required, select any object anywhere, regardless of transforms / frozen or not / pivot location, etc and then run the script, automatically centres object : -
global proc centre_Sel()
{
	string $lastSelected[] = `ls -sl`;
	group -em -name worldPoint;

	for ($i=0;$i<size($lastSelected);$i++)
		{
		select -r $lastSelected[$i];
		select -add worldPoint;
		align -atl -x Mid;
		align -atl -y Mid;
		align -atl -z Mid;
		}

	delete worldPoint;
	select -cl;
}
centre_Sel();


On a related note, this script ' floors ' an object, I always find this one handy : -
global proc snapToFloor()
{
	string $lastSelected[] = `ls -sl`;
	group -em -name worldPoint;

	for ($i=0;$i<size($lastSelected);$i++)
		{ 
		select -r $lastSelected[$i];
		select -add worldPoint;
		align -atl -y Min;
		}

	delete worldPoint;
	select -cl;
}
snapToFloor();



Regards

Replies

Sign In or Register to comment.