PDA

View Full Version : Whats wrong here? Works on PC, not MAC


bontempos
12-17-2007, 05:37 PM
Hi there.
Its just a simple quest, I hope anyone could help me.
I have wrote a expression in my pc, now it wont work in mac.

this is the code working on pc:

float $trigger = floor (frame%50);
float $goal;
float $range = 30;

if ($trigger == 0) $goal = rand(-$range , $range);
Aim_cube.rotateX += ($goal - Aim_cube.rotateX)*.3 ;

if (frame == 1 ) Aim_cube.rotateX = 0;


The cube shouldnt rotate more than 30 degrees, but in OSX it reaches highest values in a blink. I tryed to use abs(), or change the terms, but couldn work it out on mac.

Why so?

Thanks
Anderson

zanarkand
12-18-2007, 04:27 AM
I tried running the expression on a cube (in mac). The rotation looks pretty smooth to me... don't see any sudden movement...
Which maya are you using? What's your mac?
Can you perhaps attach a scene that you're having a problem with?

bontempos
12-18-2007, 04:40 PM
This is not the first time a code I ve writting in windows got messed while running on mac.
What happens is that, when I turn on the computer, and first start maya, and first load the file, it increments negative values on that expression.. so the rotation get astronomous value. So I close Maya. And the second time I load the file, the expression works correctly.

Math is organic sometimes...

Thank you for the help, Im awared now! :thumbsup:

Bontempos

zanarkand
12-18-2007, 11:35 PM
Ah... that sorta make sense...
I just notice on thing... it might make more sense to test whether $trigger equals 1 (rather than 0), because, by default, maya starts at frame 1. So with a fresh scene, the expression is never going to set a $goal for the 50 frames... in fact, there's no telling on what $goal is gonna be.
Not sure if this has anything to do with the problem you were having in the beginning...

bontempos
12-18-2007, 11:50 PM
I didnt realized it! True....maybe that was the problem with the recent openned scene.
I'll switch to 1 rather than 0.
Thanks again ;)

Bontempos

CGTalk Moderation
12-18-2007, 11:50 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.