Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 18-10-2002 , 04:20 PM
Markuz's Avatar
Registered User
Join Date: Sep 2002
Location: Germany
Posts: 135

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

# 2 19-10-2002 , 01:05 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
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!
# 3 20-10-2002 , 01:57 PM
Markuz's Avatar
Registered User
Join Date: Sep 2002
Location: Germany
Posts: 135
"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???

# 4 21-10-2002 , 05:49 PM
Markuz's Avatar
Registered User
Join Date: Sep 2002
Location: Germany
Posts: 135
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;
}

# 5 22-10-2002 , 07:45 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
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 user added image

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!
# 6 22-10-2002 , 10:55 AM
Markuz's Avatar
Registered User
Join Date: Sep 2002
Location: Germany
Posts: 135
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 user added image ) 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?

# 7 22-10-2002 , 11:39 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
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!
# 8 22-10-2002 , 11:45 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
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!
# 9 22-10-2002 , 12:08 PM
adldesigner's Avatar
Registered User
Join Date: Sep 2002
Location: CCS, Venezuela
Posts: 3,363
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! user added image 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?


Last edited by adldesigner; 22-10-2002 at 12:11 PM.
# 10 22-10-2002 , 08:03 PM
Markuz's Avatar
Registered User
Join Date: Sep 2002
Location: Germany
Posts: 135
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...

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads