CGTalk > Software > Autodesk Maya
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 09-23-2013, 11:51 PM   #1
LordRaidis
Veteran
Angelo Vildasol
---, USA
 
Join Date: Nov 2006
Posts: 76
Question World rotation VS local rotation (expression scripting)

I'm essentially attempting to create a ball rolling expression that will rotate a sphere via a locator e.g.

locator1.rotateY = polySphere1.rotateY

...with the exception that I need the locator to have the ability to rotate the sphere only on its world axis, rather than it's local one. I assume this requires a higher level of scripting than the typical straight-forward expression scripting (as shown above).

Is there anyone who knows of a quick and simple way to do this? I'm still a novice at this scripting stuff, so it'd be nice to have something I can pick apart and adapt to other things. For this, I will be eternally grateful and shall forever be in debt to you
 
Old 09-24-2013, 12:14 AM   #2
gmask
Obfuscator
 
gmask's Avatar
gmask
Power Sitting
Topanga, USA
 
Join Date: Oct 2002
Posts: 6,937
use a orient constraint?
__________________
blah blah blah
 
Old 09-24-2013, 09:09 AM   #3
LordRaidis
Veteran
Angelo Vildasol
---, USA
 
Join Date: Nov 2006
Posts: 76
Thanks for the reply. Yes I tried that. Unfortunately the orient constraint locks its target object and it loses the ability to be keyed on it's local axis. Essentially what I'm looking for is a script that will rotate an object (say, a sphere) on "world" rotation mode, while still having the ability to key it's local rotation (when necessary).

For instance, when you open up the script editor and rotate an object on the world axis, you get this:

rotate -r -ws 0 32.833727 0 ;

this...

rotate -r -ws 0 -30.391645 0 ;

or this...

rotate -r -ws -48.256342 0 0 ;

Basically it'd like to have a way of rotating a specific object (a sphere in this case) via the " rotate -r -ws 0 0 0 ; " command using a separate locator object that won't actually screw with that target's local rotation controls i.e. " rotate -r -os 0 0 0 ; " I'm certain there must be a way to do this. It would be incredibly useful.
 
Old 09-24-2013, 12:59 PM   #4
berniebernie
Schmppff...
 
berniebernie's Avatar
portfolio
Bernie B.
Paris, France
 
Join Date: Sep 2003
Posts: 1,581
simply parent your object under a null (a 'zero out' object that has the same transform attributes, so your objects is now at 0,0,0 transforms)

and apply the direct connection or orient constraint on the parent. You can still key your object as you wish.

'zero outs' are extremely often used in rigging, heck I even have a shortcut to create them on the fly.
__________________
It took God 7 days to create earth because he was using MentalRay.
showreel r/maya del.ici.ous
 
Old 09-24-2013, 03:34 PM   #5
LordRaidis
Veteran
Angelo Vildasol
---, USA
 
Join Date: Nov 2006
Posts: 76
Thanks Bernie, I tried that solution as well. The thing is, the "parent" object needs to stay locked on it's Y axis as well as it is the object that's driving the Xrotation of the child sphere. As the outer parent rotates around the Yaxis I would like the child object to rotate respectively on the Yworld axis while still being manipulated by the parent with the scripted X rotation.

It's a bit hard to explain what I have going on, so I'll attach the file. The center "MOVE" locator drives the child Xrotation, while the outer "AIM" locator follows the target locator. The system works perfectly for a wheel/tire system, but I want to adapt to make an effective sphere rolling system. The idea is that the inner most sphere rotates inversely on the Yworld axis to offset the rotation value created by the AIM constraint parent.

The primary problem is that the Xrotation parent constantly rolls the inner sphere into a different orientation so that scripting any local value on the inner sphere is useless for the effect. So a World based rotation will be necessary to offset it correctly. Just look at the .ma file and you'll see exactly what I mean...
 
Old 09-24-2013, 03:35 PM   #6
LordRaidis
Veteran
Angelo Vildasol
---, USA
 
Join Date: Nov 2006
Posts: 76

Last edited by LordRaidis : 09-24-2013 at 03:43 PM.
 
Old 09-24-2013, 10:52 PM   #7
LordRaidis
Veteran
Angelo Vildasol
---, USA
 
Join Date: Nov 2006
Posts: 76
So I've been looking into this a bit more--and boy, this is a hell of lot more difficult than I had originally anticipated. The closest thing I've been able to find for what I'm doing is the classic makeroll.mel script, but even that is extremely buggy. Anybody know of a good existing scripts for making a ball roll based on the X and Z translations?
 
Old 09-24-2013, 10:52 PM   #8
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:03 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.