Move object based on current frame

   1052   3   1
User Avatar
Member
1 posts
Joined: 3月 2018
Offline
Hi, I'm new to Houdini. I would like to move a box or other object by a certain amount using an attribute wrangler when a certain frame occurs but I'm not sure how to do it. I'm trying to use find() with arrays but it's not working. Is there something like this that can work?

float p = {8.78, 8.19, 7.31, 7.23};

float o = {0, 136, 273, 409, 545};

float frames = {100, 200, 300, 400, 500};



if(find(frames, @Frame) >= 0){
int pos = find(frames, @Frame);
@P.x += o / 20.;
@P.z += p * 2.;
}
User Avatar
Member
555 posts
Joined: 2月 2017
Offline
here, your array syntax were a bit off…plus need a solver. You can look in the solver for the fix but get out of the solver to see it running properly.
Edited by vusta - 2020年1月2日 17:58:25

Attachments:
vu_solver.hiplc (94.0 KB)

User Avatar
Member
8599 posts
Joined: 7月 2007
Offline
you don't necessarily need a solver
float p[] = {8.78, 8.19, 7.31, 7.23};
float o[] = {0, 136, 273, 409, 545};
float frames[] = {100, 200, 300, 400, 500};

foreach(int i; float frame; frames){
    if (@Frame >= frame){
        @P.x += o[i] / 20;
        @P.z += p[i] * 2;
    }
    else break;
}
Edited by tamte - 2020年1月2日 19:14:58
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
555 posts
Joined: 2月 2017
Offline
hmmm…I don't know enough vex-fu.
  • Quick Links