One attribute driven by three attributes?

One attribute driven by three attributes?

Anonymous
Not applicable
322 Views
0 Replies
Message 1 of 1

One attribute driven by three attributes?

Anonymous
Not applicable

I need a plane to change the image it displays based on the Translate X, Y and Z attributes of a locator that is parented to the camera. Basically:

 

Displayed Texture

Translate X

Translate Y

Translate Z

Front

>-10; <10

>-10; <10

>0

Back

>-10; <10

>-10; <10

<0

Right

<0

>-10; <10

>-10; <10

Left

>0

>-10; <10

>-10; <10

Underside

>-10; <10

<0

>-10; <10

Top

>-10; <10

>0

>-10; <10

Front-Left

>10

>-10; <10

>0

Front-Right

<-10

>-10; <10

>0

Back-Left

>10

>-10; <10

<0

Back-Right

<-10

>-10; <10

<0

Top-Front

>-10; <10

>10

>0

Top-Back

>-10; <10

>10

<0

Top-Left

>0

>10

>-10; <10

Top-Right

<0

>10

>-10; <10

Underside-Front

>-10; <10

<-10

>0

Underside-Back

>-10; <10

<-10

<0

Underside-Left

>0

<-10

>-10; <10

Underside-Right

<0

<-10

>-10; <10

 

I've  never done any MEL programming in my life, though, outside some very basic rigging and xgen stuff that was spoonfed to me in online tutorials, I don't know how anything's named or what anything does and I don't think I have the time to learn with this deadline coming.

 

I started working on a script and I put it in the expression editor for the attribute that's ment to drive the displayed image:

 

if ( getAttr("CamLoc.translateX") >= -10 && getAttr"CamLoc.translateX" <= 10 && getAttr"CamLoc.translateY" >= -10 && getAttr"CamLoc.translateY" <= 10 && getAttr"CamLoc.translateZ" > 0 )

setAttr "TexturePlane.CamPosition" 0;

else
{

if ( getAttr "CamLoc.translateX" >= -10 && getAttr "CamLoc.translateX" <= 10 && getAttr"CamLoc.translateY" >= -10 && getAttr"CamLoc.translateY" <= 10 && getAttr"CamLoc.translateZ" < 0 )

setAttr "TexturePlane.CamPosition" 3;

}

 

Of course, it isn't working, and even if it did, based on the table above I'd have to write about 18 of those, which might not be the best approach. Is there a more efficient solution to this?

0 Likes
323 Views
0 Replies
Replies (0)