SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.

Home / forum / Animation / Mel Scripts & Programming / move command in an expression?
Register FAQ Members List Calendar Mark Forums Read

New Thread
 
Thread Tools
Old 18-10-2002, 04:20 PM   #1
Markuz
Registered User
 
Markuz's Avatar
 
Join Date: Sep 2002
Location: Germany
Posts: 135
Thanks: 0
Thanked 0 Times in 0 Posts
Question move command in an expression?

How can I use the command "move x y z" in an expression?
I created an boolean attribute "active" and in the expression editor I roughly wrote this script:

if (name.active==true)
name.move x y z;

I know I could have written name.translateX=x and so on, but I want to move the object "name" relative to itself. (actually it's the Chevron I want to move from my "stargate" project which you can see in the W.I.P section. The have to move towards the center)
Why doesn't it work?

Thanx for help!

Markuz
Markuz is offline   Reply With Quote
Old 19-10-2002, 01:05 PM   #2
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

I can't test this right now 'cause my maya comp. is broken but i think it goes something like this:

name.move -r x y z;
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 20-10-2002, 01:57 PM   #3
Markuz
Registered User
 
Markuz's Avatar
 
Join Date: Sep 2002
Location: Germany
Posts: 135
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"r" for relative movement, that sounds good, but if the even more simple command "move x y z" does not work, why should the command "move -r x y z" work in an expression? perhaps these commands are not allowed in expressions???
Markuz is offline   Reply With Quote
Old 21-10-2002, 05:49 PM   #4
Markuz
Registered User
 
Markuz's Avatar
 
Join Date: Sep 2002
Location: Germany
Posts: 135
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I wasn't able to get the move command to work in the epressions, so I had to use the translateX and translateY command. Was a bit complicated, and would have been WAY easier when the realtive movement, "move -os x y z" by the way, would work in expressions...

Thats what I made:

if (ChevronActivator1.Activate==true)
{
ChevronActivator1.translateY=cosd(0*40)*(-0.3);
ChevronActivator1.translateX=sind(0*40)*(-0.3);
}
else if (ChevronActivator1.Activate==false)
{
ChevronActivator1.translateY=0;
ChevronActivator1.translateX=0;
}

if (ChevronActivator2.Activate==true)
{
ChevronActivator2.translateY=cosd(40)*(-0.3);
ChevronActivator2.translateX=sind(40)*(0.3);
}
else if (ChevronActivator2.Activate==false)
{
ChevronActivator2.translateY=0;
ChevronActivator2.translateX=0;
}

if (ChevronActivator3.Activate==true)
{
ChevronActivator3.translateY=cosd(80)*(-0.3);
ChevronActivator3.translateX=sind(80)*(0.3);
}
else if (ChevronActivator3.Activate==false)
{
ChevronActivator3.translateY=0;
ChevronActivator3.translateX=0;
}

if (ChevronActivator4.Activate==true)
{
ChevronActivator4.translateY=cosd(60)*(0.3);
ChevronActivator4.translateX=sind(60)*(0.3);
}
else if (ChevronActivator4.Activate==false)
{
ChevronActivator4.translateY=0;
ChevronActivator4.translateX=0;
}

if (ChevronActivator5.Activate==true)
{
ChevronActivator5.translateY=cosd(20)*(0.3);
ChevronActivator5.translateX=sind(20)*(0.3);
}
else if (ChevronActivator5.Activate==false)
{
ChevronActivator5.translateY=0;
ChevronActivator5.translateX=0;
}

if (ChevronActivator6.Activate==true)
{
ChevronActivator6.translateY=cosd(20)*(0.3);
ChevronActivator6.translateX=sind(20)*(-0.3);
}
else if (ChevronActivator6.Activate==false)
{
ChevronActivator6.translateY=0;
ChevronActivator6.translateX=0;
}

if (ChevronActivator7.Activate==true)
{
ChevronActivator7.translateY=cosd(60)*(0.3);
ChevronActivator7.translateX=sind(60)*(-0.3);
}
else if (ChevronActivator7.Activate==false)
{
ChevronActivator7.translateY=0;
ChevronActivator7.translateX=0;
}

if (ChevronActivator8.Activate==true)
{
ChevronActivator8.translateY=cosd(80)*(-0.3);
ChevronActivator8.translateX=sind(80)*(-0.3);
}
else if (ChevronActivator8.Activate==false)
{
ChevronActivator8.translateY=0;
ChevronActivator8.translateX=0;
}

if (ChevronActivator9.Activate==true)
{
ChevronActivator9.translateY=cosd(40)*(-0.3);
ChevronActivator9.translateX=sind(40)*(-0.3);
}
else if (ChevronActivator9.Activate==false)
{
ChevronActivator9.translateY=0;
ChevronActivator9.translateX=0;
}
Markuz is offline   Reply With Quote
Old 22-10-2002, 07:45 AM   #5
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Umm...I'm not sure what you're doing but aren't these equivalent:

name.move -r x y z;

vs.

name.translateX += x;
name.translateY += y;
name.translateZ += z;

Sorry if I'm just confusing you. I still haven't woken up completely

I'm not even sure if you can write "+=" but practically this is the same:

name.translateX = name.translateX + x;
name.translateY = name.translateY + y;
name.translateZ = name.translateZ + z;
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 22-10-2002, 10:55 AM   #6
Markuz
Registered User
 
Markuz's Avatar
 
Join Date: Sep 2002
Location: Germany
Posts: 135
Thanks: 0
Thanked 0 Times in 0 Posts
Default

mhh.. I do not think that it would work. scince the relative movement command "move -os x y z" (not move -r x y z ) uses another coordinate-system, other axes. Ahh.. Perhaps there's the problem. You're right, the relative movement command is "move -r x y z" and is the same as that what you've written...
But what I want to do is to use the Local axes of the object to move it.... That is the command "move -os x y z" In my Picture you'll see what I mean. I want to move, or be able to move the activators of the chevrons a bit (r in the picture) to the center. Therefor I need to move them a bit along the x and a bit along the y axes (y = cos(40)*r; x=sin(40)*r) with the relative movement (move -r x y z)
With the command I meant, the command which uses other local axes you just need to move them along ONE single axes...

How can I use this command in an expression?
Markuz is offline   Reply With Quote
Old 22-10-2002, 11:39 AM   #7
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Ok, now I see what you mean. Maybe I'll just shuddup for now and wait until I get my hands on Maya again. I'll try to get back to this then (that is if you haven't found a solution before that).
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 22-10-2002, 11:45 AM   #8
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Btw, have you tried using Driven Keys? Or is that out of the question?
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 22-10-2002, 12:08 PM   #9
adldesigner
Registered User
 
adldesigner's Avatar
 
Join Date: Sep 2002
Location: CCS, Venezuela
Posts: 3,363
Thanks: 0
Thanked 9 Times in 9 Posts
Default

This thread got heavily complicated for me, hmm, time to start looking for some basic programming resources. These kind of things make the difference. (Specially with shader networks)

By the way: On a little side node, This is my 500th post, hell!, I shouldnīt have made that custom avatar! See you around people. Iīm just happy. <adldesigner fetches himself some orange juice* and celebrates>

*Hey, itīs 8:11am in the morning, what did you think iīd drink?
__________________
adldesigner
Caracas, Venezuela
Hell .. not gone perse, but with a certainly lower post count per day.


Last edited by adldesigner : 22-10-2002 at 12:11 PM.
adldesigner is offline   Reply With Quote
Old 22-10-2002, 08:03 PM   #10
Markuz
Registered User
 
Markuz's Avatar
 
Join Date: Sep 2002
Location: Germany
Posts: 135
Thanks: 0
Thanked 0 Times in 0 Posts
Default

At the moment I do not really know what driven-keys are... mhh... I knew them once, but it was a long time ago I made something with them in a tutorial. I need to refresh my knowledge in this area...
Markuz is offline   Reply With Quote
New Thread

« Previous Thread | Next Thread »

Thread Tools

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

1 Month

$34

Month-to-month billing
$34/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
 
 

3 months

$87

Billing every 3 months
$29/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $5 per month or $15 in total compared to monthly billing with this package.

12 months

$288

Billing every 12 months
$24/month
Unlimited access to all videos
Project files to download
Easy to cancel at anytime
Save $10 per month or $120 in total compared to monthly billing with this package.

Your plan will automatically renew. You can cancel at any time via your PayPal account to avoid being charged again.

You can view the FAQ on our video plans here. You can contact us directly here. By clicking one of the buttons above, you agree to our Terms and Privacy Policy.