[Closed] At time and Scripted controller update
Hi
I have an issue, with using “at time” and a scripted controller. Using “at time” to find an objects position which is controlled by another object with a scripted controller, doesn’t give me the updated position.
I have one dummy, with a “position script”, in this script I modify the position of another object which is a sphere.
I then have a another object which is a box. I run a script, that cycles through time and should align the box to the sphere but it doesn’t, it only aligns it at the frame I’m currently viewing. (I have attached a file saved in 2012 but backwards to 2010).
I realise I could use slidertime and disable the redraw and this would work ok, but at time would be faster. Perhaps I’m approaching this in the wrong way, and there is no way to get this to work like I want it to, but I did wonder if there was a way to force the position script to update.
if anyone knows of a way to get this working that would be really helpful
thanks
for i = animationRange.start to animationRange.end do
(
with animate on
(
at time i $box001.pos = $Sphere001.pos
)
)
i’m not sure that you do what you really need but to force dummy controller updating at time context you can add the Box to the Dummy’s script controller
ps. honestly your rig doesn’t make sense for me.
edit… i’ve double checked. my solution doesn’t work… hmm… let me think a little more
ok. we don’t need to add the box to the script controller… i found a trick
for i = animationRange.start to animationRange.end do
(
with animate on at time i
(
$box001.pos = $Dummy001.pos
$box001.pos = $Sphere001.pos
)
)
or cleaner and a little faster version
with animate on for t = animationRange.start to animationRange.end do at time t
(
$Dummy001.pos
$box001.pos = $Sphere001.pos
)
well the rig is for a car.
I have all of the parts working in one scripted controller, and it goes along fine. However for speed reasons I wish the user to be able to bake out parts of the rig. So I run a separate script which goes through time and bakes out positions or rotations.
I suspect that I have made a mistake in putting all of the calculations in one scripted controller. I did this because for it was good way of controlling how all the parts interacted in the correct order. Perhaps this is the wrong way for going about things. Do you know of a thread that describes a good workflow for complex rigs?
I’ve seen your edit but yes, I couldn’t get it to work either by adding the box to the scripted controller.
Huh yeah that works, so I guess that works because we are asking the dummy to update its position, and so it runs the script?
that’s great I’m going to have to try that on my more complex rig, but it works on my test. Thanks
we are asking the dummy about its position and to answer the question the system has to update the script controller
but as i said earlier your rig doesn’t make sense for me. more obvious to add script controller to the sphere position…
my first idea was:
with animate on for t = animationRange.start to animationRange.end do at time t
(
$Dummy001.pos.controller.Update()
$box001.pos = $Sphere001.pos
)
but surprisingly it doesn’t work. so at least i know now that with at time context a script controller update doesn’t do a job at specified time.