Here is another example which is probably closer to what you really want. I'm 
making that assumption of course with no knowledge of your scene. (BTW, ignore 
the cone2 and pipe2, they are left behind as a result of my editing the MEL. 

There are some details in the original MEL which are left out or cryptic. This 
is an attempt to explain that.

What you can't easily see in the MEL that I am doing at several steps, is that 
when the Pipe and Cone are resting as children to locator2 I am executing 
Freeze Transformations then Reset Transformations on both the Pipe and Cone  
after all repositioning is final. This effectively zeroes them out in relation 
to their parent. This works if everything is aligned properly in original 
construction. 

The MEL command below that represents that freezing action on the transforms is 
"makeIdentity". I use Freeze then Reset because Freeze zeroes out the pivots, 
Reset zeroes out the transforms sending the transform "center" back to "world 
zero". The actual MEL commands are :

FreezeTransformations;
ResetTransformations;

They are normally executed from Modify. They can be seen in MEL if you set the 
script editor to Echo All Commands. It may not look like Reset is doing 
anything if you have not moved the object away from world center. Reset's 
action will only be evident if you move the object to something of non-zero 
translation. Generally its just habit after 20 years, I always execute Freeze 
then Reset as a default part of the process. If the object wasn't moved, it 
wont hurt it.


A synopsis of the process is as follows:

Create, rotate and move the pipe. Preferably at world center and its length 
aligned with z axis. 
Create, rotate, and move the  cone (analog for a bullet I guess). Also at world 
center and also aligned with z axis for z translation in relation to the pipe.
Parent both under a locator. Also at World center. Do not move or change its 
position or orientation.
Execute Freeze/Reset on both Pipe and Cone.
Move & rotate the locator at will. Cone should follow the pipe and be keyable 
as translation only in the z axis to follow the pipe.
 

Here is the MEL to demonstrate.



file -f -new;
CreatePolygonCone;
polyCone -r 1 -h 2 -sx 20 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1; 
setAttr "pCone1.rotateX" -90;
CreatePolygonPipe;
polyPipe -r 1 -h 2 -t 0.5 -sa 20 -sh 1 -sc 0 -ax 0 1 0 -cuv 1 -rcp 0 -ch 1;
setAttr "pPipe1.rotateX" -90;
select -cl  ;
spaceLocator -p 0 0 0;
spaceLocator -p 0 0 0; 
select -r locator1 ;
selectKey -clear ;
select -r locator2 ;
selectKey -clear ;
parent locator2 locator1 ;
parent pPipe1 locator2 ; 
select -r pCone1 ;
selectKey -clear ;
parent pCone1 locator2 ; 
select -r locator2 ;
selectKey -clear ;
select -r pPipe1 ;
selectKey -clear ;
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
select -r pCone1 ;
selectKey -clear ;
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
select -r pPipe1 ;
selectKey -clear ;
setAttr "pPipe1.scaleZ" 10;
select -addFirst polyPipe1 ;
setAttr "polyPipe1.thickness" .1;
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0 -pn 1;
select -r locator1 ;
selectKey -clear ;
rotate -r -os -fo 32.234531 0 0 ;
rotate -r -os -fo 0 33.615086 0 ;
select -r pCone1 ;
selectKey -clear ;
if( `getAttr -k "pCone1.tz"`||`getAttr -channelBox "pCone1.tz"` )setKeyframe 
"pCone1.tz";
currentTime 30 ;
move -r -ls -wd 0 0 -37.704086 ;
if( `getAttr -k "pCone1.tz"`||`getAttr -channelBox "pCone1.tz"` )setKeyframe 
"pCone1.tz";




Joey






-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Ponthieux, Joseph 
G. (LARC-E1A)[LITES II]
Sent: Monday, September 11, 2017 9:52 AM
To: [email protected]
Subject: RE: Maya - what were they thinking 2 - transforms

More than likely this has something to do with the way your hierarchy is 
organized. There is no reason why you can't do this. The key to making this 
work is that the gun cannot have had its pivot or transforms modified in 
relation to the child. The object as child to the gun must be zero-centric to 
it. In other words, the gun must be the "world" coordinates for the gun. Does 
that make sense?

Run the MEL commands below in your script editor in an empty scene. See 
specifically the angle of locator2 and the keyframed z translation of pCone1. 
Move locator1 around at will, and you can change the orientation of locator2 if 
you desire, but the cone's motion is always maintained on Z axis relative 
everything it is parented to. And it is only animated explicitly on Z. See the 
Graph editor for pCone1. Is this similar to what you are trying to accomplish?




file -f -new;
spaceLocator -p 0 0 0;
updateRenderOverride;
spaceLocator -p 0 0 0;
CreatePolygonCone;
polyCone -r 1 -h 2 -sx 20 -sy 1 -sz 0 -ax 0 1 0 -rcp 0 -cuv 3 -ch 1; parent 
pCone1 locator2 ; select -r locator2 ; selectKey -clear ; parent locator2 
locator1 ; select -r locator2 ; selectKey -clear ; rotate -r -os -fo 9.453111 0 
0 ; setAttr "locator2.rotateX" 45; select -r pCone1 ; selectKey -clear ; if( 
`getAttr -k "pCone1.tz"`||`getAttr -channelBox "pCone1.tz"` )setKeyframe 
"pCone1.tz"; currentTime 30 ; move -r -ls -wd 0 0 -8.127347 ; if( `getAttr -k 
"pCone1.tz"`||`getAttr -channelBox "pCone1.tz"` )setKeyframe "pCone1.tz"; 
currentTime 22 ; selectKey -clear ; currentTime 15 ; select -r locator2 ; 
selectKey -clear ; select -r locator2 pCone1 ; selectKey -clear ; select -r 
pCone1 ; selectKey -clear ;





Joey Ponthieux
__________________________________________________
Opinions stated here-in are strictly those of the author and do not 
represent the opinions of NASA or any other party.






-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Morten Bartholdy
Sent: Monday, September 11, 2017 6:17 AM
To: Userlist, Softimage <[email protected]>
Subject: Maya - what were they thinking 2 - transforms

So I understand (to some degree) that there are fundamental differences between 
the  way transformations are handled in Maya vs Soft, but I just ran into 
something which on the surface looks simple, but is quite mindboggling. 
Hopefully it is just a case of Mayas way of hiding useful stuff in some obscure 
submenu or relationship editor, but here goes:

I am doing some very simple keyframe animation in Maya (one of the few things 
that does not drive me entirely crazy) and am animating a thingy which is 
parented to a gun which is pointed in a particular direction. I just want it to 
fly of on its local z-axis so I select it, set Transform Tool Settings, Axis 
Orientation to Object, key frame translate out along z-axis and keyframe. Now I 
want to edit the function curves to make sure it accelerates as desired, open 
the graph editor and see graph representation of its motion is in world space, 
ie. it is not only animated on the z-axis, but also on x and Y. Obviously 
editing these curves  manually will easily lead to having the object not flying 
in a straight line...

In this case I could draw a curve to use as motion path, but is is more 
cumbersome (like so many things in Maya) and for many reasons I would really 
prefer to be able to switch between World space and Object space in the Graph 
Editor. Our resident Maya artist has looked for similar functionality many 
times through different Maya versions, so far without luck, so she can not 
offer relief from this specific lack of brainpower on the part of the Maya devs.

Can Maya knowledgeable people here confirm this fundamental lack of 
functionality or perhaps tell where I find it, or barring that, offer advice 
regarding how to achieve something similar?

Thanks (sigh)

Morten
------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with 
"unsubscribe" in the subject, and reply to confirm.

------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with 
"unsubscribe" in the subject, and reply to confirm.

------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with 
"unsubscribe" in the subject, and reply to confirm.

Reply via email to