I am trying to procedurally animate things in Houdini, using similar logic as in Unity, moving the object based on its position from last update, i.e., NewPosition = OldPosition + Direction * Coefficient. (The direction vector uses a sequence of weighted input so it's really hard to convert the entire thing into integral)
Using the Vex code below inspired by this post:
vector@posRecord[];
// ... if (@Frame == 1)
{@P = {0, 0, 0};
}else{vectorlastPos = @posRecord[len(@posRecord) - 1];
v@lastRead = lastPos;
@P = lastPos + @N * 10; // @N as direction }append(@posRecord, @P);
if (len(@posRecord) > 10)
removeindex(@posRecord, 0);
I am able to record the position, but `lastPos` cannot properly read from `@posRecord`. In Geometry Spreadsheet `lastPos` keeps being 0. As a result, the object is merely reading the `@N` as XYZ positions instead of move based on `@N`.
tamte You need to be in a simulation environment to be able to feed back attribute values between frames
Like inside of Solver SOP or inside of DOPnet directly
You could use forloop with feedback and animate the number of iterations with the frame number, but you might cook all of the iterations each frame. I'm not sure if it caches the last step or not.