(Houdini, Python)

Python cook per Frame on created Point

Python animated

Houdini Python animated Point

hou.frame() sorgt dafür das das Python als animiert angesehen und somit bei Animationen oder beim Abspielen der Timeline aktualisiert wird.


# Import math Library
import math

node = hou.pwd()
geo = node.geometry()

# forces a time based cook, even if not used later
current = hou.frame() / 10

x = math.sin(current)
y = math.sin(current / 2)
z = math.cos(current)

pt0 = geo.createPoint()
pt0.setPosition(hou.Vector3(x, y, z))

Python cook per Frame on input Geo

Python animated

Houdini Python first Input animated

hou.frame() sorgt hier ebenfalls für ein recook bei jedem Frame.


# Import math Library
import math
import numpy

node = hou.pwd()
geo = node.geometry()

# forces a time based cook, even if not used later
current = hou.frame() / 10

x = math.sin(current)
y = math.sin(current / 2)
z = math.cos(current)

for point in geo.points():
  pos = point.position()
  add = hou.Vector3(x, y, z)
  pos_new = numpy.add(pos,add)
  point.setPosition(pos_new)