Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 18-10-2002, 05: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, 02: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, 02: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, 06: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, 08: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, 11: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, 12:39 PM   #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, 12:45 PM   #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, 01: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 01:11 PM.
adldesigner is offline   Reply With Quote
Old 22-10-2002, 09: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

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.