Frei Otto Asset – design tip – Tutorial
People asked me how to do the patterns from the FreiOttoAttractor Asset Walktrough Video
(vimeo.com/347481484)
Here is a short tutorial for this!
以下为视频中用到的vex代码:
Code For First Wrangle Node (Circle Generator)
第一个wrangle节点的代码(圆生成器):
//user controls
int sample = chi(‘sample’);
float radius = ch(‘radius’);
vector center = chv(‘center’);
float TWO_PI = 3.14*2;
//circle formula
float theta = 0;
float step = TWO_PI / (float)sample;
float x,z;
vector pos;
while(theta < TWO_PI)
{
x = center.x + cos(theta)*radius;
z = center.z + sin(theta)*radius;
pos = set(x, center.y, z);
addpoint(0, pos);
theta += step;
}
Code for Second Wrangle (Lines Generator)
第二个wrangle节点的代码(线生成器):
//user controls
int line = addprim(0, ‘polyline’);
int const_offset = chi(‘offset’);
float phase = ch(‘phase’);
float Pi = 3.14;
//additional offset
float fit_ptnum = fit(@ptnum, 0, npoints(0), 0, Pi*phase);
int sin_offset = (int)(sin(fit_ptnum) * ch(‘sin_offset’));
//find connection neighbour
int neigh = (@ptnum + const_offset + sin_offset)%npoints(0);
//create the connection line
addvertex(0, line, @ptnum);
addvertex(0, line, neigh);
Code is designed by Anastasia Opara and is explained in detail in this video vimeo.com/204994936
Frei Otto Attractor asset is here : digital-alchemist.com/product/frei-otto/
Thank youy and enjoy this tip