Created
June 14, 2020 09:49
-
-
Save josemorval/f25fc8bc6bc4654fc08d3cd48f522dd8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //FROM TOKERU HOUDINI BLOG | |
| matrix morig = ident(); | |
| matrix3 mrotate = ident(); | |
| vector axis, pos, origin; | |
| float angle, d, max; | |
| // get control transform | |
| morig = primintrinsic(1,'packedfulltransform',0); | |
| // move the grid to the inverse of that position | |
| @P *= invert(morig); | |
| // setup a falloff based on distance to origin | |
| max = ch('max'); | |
| pos = @P; | |
| d = length(pos); | |
| d = fit(d,0,max,1,0); | |
| d = pow(d,ch('exp')); | |
| // debug falloff if required | |
| //@Cd = d; | |
| // rotate | |
| axis = {0,0,1}; | |
| angle = ch('angle'); | |
| angle *= d; | |
| rotate(mrotate, -angle, axis); | |
| @P-=0.5*d*set(0.,0.,1.); | |
| // apply rotation, then revert transform | |
| @P *= mrotate; | |
| @P *= morig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment