POP_rotaion[vex]
2019. 1. 2. 01:06ㆍStudy/Houdini_Skill
Pop_Rotation
popnet에서 pop sim을 했을 때 자동으로 돌아가는 vex 구조
3가지의 pop_wrangle을 이용한다.
pop scale 속성을 준다.
1 2 3 4 5 6 7 8 9 10 11 12 13 | float pscale; pscale = rand(@id); pscale = chramp("pscale_ramp",pscale); pscale = fit01(pscale, ch("min_scale"),ch("max_scale")); f@pscale = pscale; float vLength = length(@v); if(vLength > 0.1){ f@dis = @dis + vLength * @TimeInc; } | cs |
방향을 알려준다.
1 2 3 4 5 6 7 8 | float vLength = length(@v); if (vLength>0.3){ v@vel_dir = avg(@vel_dir, normalize(@v)); } else{ v@vel_dir = @vel_dir; } | cs |
rotate 속성값을 준다.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | vector upVector = set(0,1,0); vector xAxis = normalize(v@vel_dir); vector zAxis = normalize(cross(xAxis, upVector)); vector yAxis = normalize(cross(zAxis, xAxis)); v@xAxis = xAxis; v@yAxis = yAxis; v@zAxis = zAxis; matrix3 rotMatrix = set(xAxis, yAxis, zAxis); f@determ = determinant(rotMatrix); float circuit = @pscale * $PI * 2; float angle = radians(@dis/circuit * 360); rotate(rotMatrix, -angle, zAxis); p@orient = quaternion(rotMatrix); | cs |
circuit 의 공식은 원둘레 구하는 공식인데 여기서 @psclae 은 반지름이 된다.
'Study > Houdini_Skill' 카테고리의 다른 글
CST_setup (0) | 2019.05.23 |
---|---|
HDA_Compile_fracture(voronoifracture) (0) | 2019.05.22 |
Sim_Particle_이전 frame 가지고 오기 (0) | 2018.08.05 |
Center (0) | 2018.07.30 |
Proxy_UPRES (0) | 2018.07.27 |