Reputation: 1080
I am trying to procedurally animate things in Houdini, using similar logic as in Unity, moving the object based on its current position, i.e., NewPosition = OldPosition + Direction * Coefficient
.
Using the Vex code below inspired by this post:
vector @posRecord[];
// ...
if (@Frame == 1)
{
@P = {0, 0, 0};
}
else
{
vector lastPos = @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
.
What is going and is there a way to fix this?
Upvotes: 0
Views: 284