Yunus B

animatrix3d

About Me

Expertise
Not Specified
Location
Not Specified
Website

Connect

Recent Forum Posts

Snap normal to nearest 45 degree angle in vex? Jan. 19, 2019, 6:08 p.m.

Hi,

You can do something like this:

float getAngleBetweenVectors(vector v0; vector v1)
{
    vector v0n = normalize(v0);
    vector v1n = normalize(v1);
    return atan2(length(cross(v0n,v1n)), dot(v0n, v1n));
}

vector axes[]={{1,0,0},{0,1,0},{0,0,1}};

float ax = getAngleBetweenVectors(@N, axes[0]);
float ay = getAngleBetweenVectors(@N, axes[1]);
float az = getAngleBetweenVectors(@N, axes[2]);

float angles[] = array(ax, ay, az);

@N = axes[argsort(angles)[0]];

Lambda SOP Jan. 14, 2019, 1:40 a.m.

Thanks man

Lambda SOP Jan. 6, 2019, 11:08 p.m.

This operator allows you to call a collection of nodes on any data or simply no data (generators). It gives you full control over how the lambda function should be run.