Notifications
Clear all

[Closed] script controller and time

 rdg

Hi,

inspired by the recent threads about programmed motion/behaviour [1][2][3] I started to think about different approaches.

Aaeron, eek and PEN already contributed some very usefull tips.

The main problem I currently encounter is the problem of time.
I don’t understand how time is used inside a scriptcontroller.

How do you ‘catch’ the first frame inside a script controller – i.e. to reset some values?
How many times per frame is a script controller executed – can this be controlled?

 format "T: % - F: % - S: % - NT: % - currentTime: %
" T F S NT currentTime 

Depending on the time range this outputs different values, but it seems it output
6 times the values for the startframe
n times negative values
m times for frames of the range
1 time the start frame

I guess this is not an valid way to investigate this.
Max uses 4800ticks/second so the results may vary and there may be fractional frames.

Georg

[1] http://forums.cgsociety.org/showthread.php?f=98&t=446280&highlight=challenge
[2] http://forums.cgsociety.org/showthread.php?f=98&t=497415
[3] http://forums.cgsociety.org/showthread.php?f=98&t=493723

2 Replies
 PEN

Depending on the dependancies in a rig the script controller might get called more or less. Also have you noticed that script controllers also have built in variables for time. For instance F will returns the currentTime in frames and T will return it in Ticks.

You can then use this for instance…


 at time F p1=theObject.pos
 at time (F-1) p2=theObject.pos
 
 vel=distance p1 p2
 
 rdg

:argh:
As you already noticed I sometimes loose track in my proceedings.

I tried a million times:

if F == 0 then (
 val == 10
)else(
 val = random 10 20
)
val

And I couldn’t see a pattern in what’s going on.

well, now I tried it again and it works.

hmm …

Thanks.

Georg