Pivot rotation in VEX (instead of using $CEX/Y/Z in a Transform node)
5531
2
1
Dec. 16, 2017 11:42 a.m.
Hello everyone,
I've been wreaking my head for a while now on how I'd go about rotating points in a for-loop using VEX.
I can get it to work using a transform and $CEX/Y/Z but using VEX I can only get it to rotate from the origin (I think).
I'd love to see if anyone out there could give me a hint on how to achieve this using VEX as I can't find an answer I can grasp using google.
Here's what I've got so far.
int iteration = detail (1 , "iteration" , 0 );
float rotAmountY = rand ((.456 + iteration ) - .5 ) * 45 ;
matrix3 myMatrix = ident ( );
rotate ( myMatrix , radians ( rotAmountY ), { 0 , 1 , 0 } );
@P *= myMatrix ;
f@pscale = fit (rand (0.34234 * iteration ), 0 , 1 , 0.75 , 1 );
Best Regards
Jona
vusta
Member
555 posts
Joined: Feb. 2017
Offline
Dec. 19, 2017 12:25 a.m.
here's my clunky way..no not VEX, but maybe you can adapt…please note in the random rotate, I've changed the Transform order to Scale Trans Rot…ie. Transform to Origin first, Rotate, then move back out to orig location…this would be the same logic in VEX, ie. transform to Origin first, do your business, move back out…
Attachments:
RandomRotate.hipnc (73.7 KB)
Dec. 19, 2017 12:41 p.m.
Thanks vusta, that was pretty close to my initial solution but done in a completely different way, very interesting!