[Closed] controlling point cache playback speed with object travel speed ?
hey guys im looking for a way to control point cache playback speed
via object travel speed
im trying to make a very simple crowd workflow
i was planning on using objects with cached animation , lets say walk cycle
and controlling the speed the animation is played by the speed the object is moving
from what i can see so far i think the way to go is with the “playback graph” option
in playback type rollout
but im not completely sure on how to control that via maxscript
my first idea is to define the correct or “base” speed that looks good with the animation used.
then using a script controller change the speed according to difference in speed compared to the “base” speed .
but im having trouble connecting it to the modifier .
any and all ideas or thoughts would be extremely welcome
As far as I know, the only way to solve things like this is by a script (or something more powerful) since this is history dependent. So I would add a script controller to the playback graph subanim.
This is the pseudo code for the script controller:
[ul]
[li]currentVelocity = currentPos – previousPos
[/li][li]newValue = lastValue + currentVelocity * multiplier
[/li][li]lastValue = newValue
[/li][li]return newValue
[/li][/ul]
you will have to hold a variable in the controller to store the lastValue variable
interesting , I forgot about finding the speed of the object first … Hahaha
Ok I’ll give it a try soon , thanks !!
i had an idea of dropping a waveform controller on the “playback frame” of the point cache
because then i would just need to work with the “period” value of the waveform controller
and not mess around with frame numbers , and its good for looping animation.
but i cant find any way of gaining access to the waveform controller via maxscript or wiring
…
back to the drawing board
I don’t remember if I ever tried accessing the waveform controlling via script, but you could easily create your own periodic controller with a simple expression controller using a sin() function. It would also be very efficient.
am i missing anything? is it not just simple as to set controller’s the After Out-of-Range type (ORT) to #loop or #relativeRepeat?
so i set the playback type to “playback graph”
create 2 key frames for start of animation and end of animation
then code something like this :
setAfterORT $Sphere001.modifiers[#Point_Cache].playbackFrame.controller #loop
and then move the last keyframe to control the speed of the animation via max script ?
i played with the idea of just creating 2 keyframes for the point cache modifier playback frame
and tried to move the second keyframe according to a value that right now im getting form
a ExposeTransform distance
and it seams to freeze max
i was trying something like this:
while distance > 0 do keyframe2 = distance (pseudo code)
is that the right way to do it ?
i also tried to wire the playback frame to the distance value
it worked but i lost the out of range looping option
can i define in the wire parameters the value to loop or cycle on top of the
distance or speed and playback frame calculation ??
and if so is either one better than the other for large number of objects in performance ?