Move Point with Point Wrangle without "@Frame" - A

   5178   2   2
User Avatar
Member
2 posts
Joined: Feb. 2016
Offline
Hey everyone,
I am pretty new to Houdini and Vex and hope you can help me.
I am trying to dynamically move a point, using a point wrangle node.

I know that it can be achieved by writing something like this

v@offset = set(0.0,1.0,0.0);
@P += @offset * @Frame,


But now let's say, you want to move the point by a random vector, which is constantly changing each frame. By using the @Frame Attribute I am getting very weird results, because the random vector is multiplied each time by the frame number.

Is it possible to get the desired result without the @Frame Attribute?

Thanks,
Patrick
User Avatar
Member
1743 posts
Joined: May 2006
Offline
rand() or noise() need an input to calculate their output. If you move @Frame (or @Time) inside the function, then the result will always be within a fixed range, but will be different every frame.

The one you use depends on the result you want. rand() is truly random, so returns a totally different result each frame. noise() is a smoothly varying randomness.

In the attached gif, the left is sphere uses noise(), the right is rand().

The expressions look like this:

v@offset = noise(@Time);
@P += @offset;

and

v@offset = rand(@Frame);
@P += @offset;

Attachments:
noise_and_rand.hipnc (93.0 KB)
noise_and_rand.gif (163.5 KB)

http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
2 posts
Joined: Feb. 2016
Offline
Thanks mestela,
works perfectly.
  • Quick Links