View Full Version : circular dependency issue..
3rd Dimentia 07-11-2008, 12:49 AM This is a similar problem that I come up against all the time. And have not been able to find a solution. I have a short looping animation (16 frames) and I want to play it in viewport and be able to have a camera spin around it. But I don't want the camera to loop over the 16 frames too... I want to just add 1 degree to the Z rotation of it's target (the cam is linked to the target) every time it recalculates the script controller which I'm assuming is once a frame. The issue I have is circular dependency. If I try to make one object rotate another and then back again. I sort of understand that one will rotate the other, and then back thus in a way creating a loop. But I can't get over the fact that they don't actually happen at the same time. I would have thought they would happen one at a time and only once per frame. So one would chage based on the other's value and then after that, the reverse would happen. But obviusly it doesn't work like this. And how do people deal with this problem?
|
|
erilaz
07-11-2008, 03:41 AM
The only way I can really think of doing it is to either change your timeline to 360 frames with a loop on the 16 frame animation or set up a callback script.
There is a way to do global variable storing, but my way is a little hacked:
Create a dummy in the scene. Set up any script controller and add the variable global value1 = 0 to the top of the script
Create your rotation controller on the target. Reference value1 for your rotation calculations
Play. You'll see nothing change, as value1 is being repeatedly updated in the dummy controller
Delete the dummy.
value1 remains global and the camera rotation updates continually.
As you can see, the flaw is very apparent. :)
You could do something similar with a global call script or a referene to an attribute holder, but as for a rock solid script controller that does global functions i'm not sure.
EDIT: I'd lke to point out to that the hacky method above may freeze up max if you load it later, but hey, it's a start! :P
Also note, you cannot assume it only updates once a frame, cause it's way more then that. You'll need some custom attribute to store values and check for differences each frame. I have to say I have not been lucky with this approach so far, but I know it's being used by PEN and others. There was a thread about it some a few days ago.
-Johan
Here is that thread
http://forums.cgsociety.org/showthread.php?f=98&t=649150
Don't forget you need to bake before net work rendering.
CGTalk Moderation
07-11-2008, 12:38 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.