Generative Sea slugs - Pattern POP + custom attractor TouchDesigner
Автор: Dan Tapper
Загружено: 2025-07-25
Просмотров: 647
A simulated sea slug. A dive into using the pattern POP to make generative organisms.
Project file patcher level here: https://www.patreon.com/posts/generat...
mulit slug +attractor tox component level: https://www.patreon.com/posts/generat...
Fin rotation code:
import math
def onCook(scriptOp):
Input CHOP has 3 channels: x, y, z (heading or direction vector)
vx = scriptOp.inputs[0]['x'][0]
vy = scriptOp.inputs[0]['y'][0]
vz = scriptOp.inputs[0]['z'][0]
Normalize direction vector
length = math.sqrt(vx**2 + vy**2 + vz**2)
if length == 0:
vx, vy, vz = 0, 0, 1 # default forward
else:
vx /= length
vy /= length
vz /= length
Compute yaw (rotation around Y axis) - horizontal direction
ry = math.degrees(math.atan2(vx, vz))
Compute pitch (rotation around X axis) - vertical tilt
horizontal_mag = math.sqrt(vx**2 + vz**2)
rx = math.degrees(math.atan2(-vy, horizontal_mag))
Optional: compute roll (rz) from change in tangent vector, or leave as 0
rz = 0.0
Output rotation channels
scriptOp.clear()
scriptOp.appendChan('rx')
scriptOp.appendChan('ry')
scriptOp.appendChan('rz')
scriptOp['rx'][0] = rx
scriptOp['ry'][0] = ry
scriptOp['rz'][0] = rz
return
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: