that was 2d trig, but here is the code of me, trying to fix it.
pawn Code:
/*Trig3D(Float:x, Float:y, Float:z, Float:radius, Float:tilt, Float:facingangle, Float:angle, &Float:retx, &Float:rety, &Float:retz)
{
new Float:xrad, Float:yrad;
xrad = ((radius * (floatcos(tilt, degrees) * floatcos(facingangle, degrees))));
yrad = ((radius * (floatcos(tilt, degrees) * floatsin(facingangle, degrees))));
retz = ((radius * floatsin(tilt, degrees) * floatsin(angle, degrees)) + z);
retx = ((xrad * floatcos(angle, degrees)) + x);
rety = ((yrad * floatsin(angle, degrees)) + y);
if (0.1 >= floatsin(tilt, degrees) >= -0.1)
{
retx = radius * floatcos(angle, degrees) + x;
rety = radius * floatsin(angle, degrees) + y;
}
return 1;
}*/
/*
Trig3D(Float:x, Float:y, Float:z, Float:radius, Float:tilt, Float:facingangle, Float:angle, &Float:retx, &Float:rety, &Float:retz)
{
retx = ((floatcos(tilt, degrees) * floatcos(angle, degrees) * radius) + x);
rety = ((floatcos(tilt, degrees) * floatsin(angle, degrees) * radius) + y);
retz = ((floatsin(tilt, degrees) * radius) + z);
return 1;
}*/
/* //backup
Trig3D(Float:x = 0.0, Float:y = 0.0, Float:z = 0.0, Float:radius = 0.0, Float:tilt = 0.0, Float:facingangle = 0.0, Float:angle = 0.0, &Float:retx = 0.0, &Float:rety = 0.0, &Float:retz = 0.0)
{
new Float:xtilt, Float:ytilt;
xtilt = floatsin(facingangle, degrees)+floatcos(tilt, degrees);
ytilt = floatcos(facingangle, degrees)+floatcos(tilt, degrees);
retx = radius * (floatcos(angle, degrees)*xtilt);
retz = radius * (floatsin((tilt), degrees)*floatsin(angle,degrees));
rety = radius * (floatsin(angle, degrees)*ytilt);
return 1;
}
*/
/* // almost there
Trig3D(Float:x = 0.0, Float:y = 0.0, Float:z = 0.0, Float:radius = 0.0, Float:tilt = 0.0, Float:facingangle = 0.0, Float:angle = 0.0, &Float:retx = 0.0, &Float:rety = 0.0, &Float:retz = 0.0)
{
new Float:xtilt, Float:ytilt;
xtilt = floatsin(facingangle, degrees)+floatcos(tilt, degrees);
ytilt = floatsin(facingangle, degrees)+floatcos(tilt, degrees);
retx = radius * (floatcos(angle, degrees)*xtilt);
retz = radius * (floatsin((tilt), degrees)*floatcos(angle,degrees));
rety = radius * (floatsin(angle, degrees)*ytilt);
return 1;
}
*/
Trig3D(Float:x = 0.0, Float:y = 0.0, Float:z = 0.0, Float:radius = 0.0, Float:tilt = 0.0, Float:facingangle = 0.0, Float:angle = 0.0, &Float:retx = 0.0, &Float:rety = 0.0, &Float:retz = 0.0)
{
new Float:xtilt, Float:ytilt;
xtilt = floatsin(tilt*floatsin(facingangle, degrees), degrees);
ytilt = floatsin(tilt*floatcos(facingangle, degrees), degrees);
retx = radius * (floatcos(angle*floatsin(facingangle, degrees)*floatcos(tilt, degrees)*floatsin(angle, degrees), degrees));
retz = radius * (floatsin((tilt), degrees)*floatcos(angle,degrees));
rety = radius * (floatsin(angle*floatcos(facingangle*floatsin(tilt, degrees)*floatsin(angle, degrees), degrees), degrees));
return 1;
retx = radius * (floatcos(0.0*0.0*1.0*0.0, degrees)); //should be 1.0 is 1.0
retx = radius * (floatcos(0.0*0.0*0.0*0.0, degrees)); //should be 0.0 is 1.0
retx = radius * (floatcos(90.0*0.0*1.0*1.0, degrees)); //should be 1.0 is 1.0
retx = radius * (floatcos(0.0*1.0*0.0*1.0, degrees)); //should be 1.0 is 1.0
retx = radius * (floatcos(0.0*1.0*1.0*1.0, degrees)); //should be 0.0 is 1.0
retx = radius * (floatcos(90.0*0.0*1.0*0.0, degrees)); //should be 1.0 is 1.0
retx = radius * (floatcos(0.0*floatsin(0.0, degrees)*floatcos(0.0, degrees)*floatsin(0.0, degrees), degrees)); //should be 1.0
retx = radius * (floatcos(0.0*floatsin(0.0, degrees)*floatcos(90.0, degrees)*floatsin(0.0, degrees), degrees)); //should be 0.0
retx = radius * (floatcos(90.0*floatsin(90.0, degrees)*floatcos(90.0, degrees)*floatsin(90.0, degrees), degrees)); //should be 1.0
retx = radius * (floatcos(0.0*floatsin(0.0, degrees)*floatcos(0.0, degrees)*floatsin(0.0, degrees), degrees)); //should be 1.0
retx = radius * (floatcos(0.0*floatsin(0.0, degrees)*floatcos(90.0, degrees)*floatsin(0.0, degrees), degrees)); //should be 0.0
retx = radius * (floatcos(90.0*floatsin(90.0, degrees)*floatcos(90.0, degrees)*floatsin(90.0, degrees), degrees)); //should be 1.0
}
/* //some problems
Trig3D(Float:x = 0.0, Float:y = 0.0, Float:z = 0.0, Float:radius = 1.0, Float:tilt = 0.0, Float:facingangle = 0.0, Float:angle = 0.0, &Float:retx = 0.0, &Float:rety = 0.0, &Float:retz = 0.0)
{
new Float:xtilt, Float:ytilt;
xtilt = floatsin(facingangle*floatsin(tilt, degrees), degrees);
ytilt = floatcos(facingangle*floatsin(tilt, degrees), degrees);
printf("%f %f", xtilt, ytilt);
retx = radius * (floatsin(angle*(floatsin(xtilt*90.0, degrees)), degrees));
retz = radius * (floatsin((tilt)*floatcos(angle, degrees), degrees));
rety = radius * (floatsin(angle, degrees)*ytilt);
return 1;
}
*/
/*
Trig3D(Float:x = 0.0, Float:y = 0.0, Float:z = 0.0, Float:radius = 0.0, Float:tilt = 0.0, Float:facingangle = 0.0, Float:angle = 0.0, &Float:retx = 0.0, &Float:rety = 0.0, &Float:retz = 0.0)
{
new Float:xtilt, Float:ytilt, Float:xangle, Float:yangle;
xtilt = floatsin(facingangle, degrees)+floatcos(tilt, degrees);
ytilt = floatsin(facingangle, degrees)+floatcos(tilt, degrees);
xangle = floatsin(facingangle, degrees)*floatcos(tilt, degrees)
yangle = floatsin(facingangle, degrees)*floatcos(tilt, degrees);
retx = radius * (floatcos(angle*xangle, degrees)*xtilt);
retz = radius * (floatsin((tilt), degrees)*floatcos(angle+tilt-90.0,degrees));
rety = radius * (floatsin(angle*yangle, degrees)*ytilt);
return 1;
}
*/
/*Trig3D(Float:x, Float:y, Float:z, Float:radius, Float:tilt, Float:facingangle, Float:angle, &Float:retx, &Float:rety, &Float:retz)
{
if (0.1 >= floatsin(tilt, degrees) >= -0.1)
{
retz = z;
retx = radius * floatcos(angle, degrees) + x;
rety = radius * floatsin(angle, degrees) + y;
}
else
{
new Float:temprad;
temprad = (((radius) * floatsin(tilt, degrees)) );
retz = ((temprad * floatcos(tilt, degrees)) + z);
retx = ((temprad * floatcos(angle, degrees)) + x);
rety = ((temprad * floatsin(angle, degrees)) + y);
}
return 1;
}*/
/*Trig3D(Float:x, Float:y, Float:z, Float:radius, Float:tilt, Float:facingangle, Float:angle, &Float:retx, &Float:rety, &Float:retz)
{
if (0.1 >= floatsin(tilt, degrees) >= -0.1)
{
retz = z;
retx = radius * floatcos(angle, degrees) + x;
rety = radius * floatsin(angle, degrees) + y;
}
else
{
retx = x + (radius * floatcos(angle, degrees) * floatsin(tilt, degrees));
rety = y + (radius * floatsin(angle, degrees) * floatsin(tilt, degrees));
retz = z + (radius * floatcos(tilt, degrees));
}
return 1;
}*/
/*
Trig3D(Float:x, Float:y, Float:z, Float:radius, Float:tilt, Float:facingangle, Float:angle, &Float:retx, &Float:rety, &Float:retz)
{
new Float:anglex = (floatcos(tilt, degrees) * floattan(facingangle, degrees)) * floatcos(angle, degrees);
new Float:angley = floatcos(tilt, degrees) * floattan(facingangle, degrees) * floatsin(angle, degrees);
new Float:anglez = floatsin(tilt, degrees) * floatsin(angle, degrees);
printf("%f %f %f", anglex, angley, anglez);
retx = x;
rety = floatcos(anglex, degrees)*y - floatsin(anglex, degrees)*z;
retz = floatsin(anglex, degrees)*y + floatcos(anglex, degrees)*z;
retx = floatcos(angley, degrees)*retx - floatsin(angley, degrees)*rety;
rety = floatsin(angley, degrees)*retx + floatcos(angley, degrees)*rety;
retz = retz;
retx = floatcos(anglez, degrees)*retx - floatsin(anglez, degrees)*retz;
rety = rety;
retz = floatsin(anglez, degrees)*retx + floatcos(anglez, degrees)*retz;
retx *= radius;
rety *= radius;
retz *= radius;
return 1;
}
*/