Good news for mapmakers
Good news for mapmakers
21 years 1 month ago
I finally cracked the vertical L-Point code! Enjoy.
For the geog program:
For the geog program:
Code:
void PlaceLpoint(Lpoint_T * data, float percentage)
{
Entity_T * moon;
Entity_T * planet;
double vecx, vecy, vecz, dist, x, y, z, angle;
moon = &geog_array[data->moon_index].entity;
planet = &geog_array[data->center_index].entity;
vecx = moon->x_pos - planet->x_pos;
vecy = moon->y_pos - planet->y_pos;
vecz = moon->z_pos - planet->z_pos;
dist = sqrt(vecx*vecx+vecy*vecy+vecz*vecz);
x = vecx/dist;
y = vecy/dist;
z = vecz/dist;
vecx = x*dist*percentage + planet->x_pos;
vecy = y*dist*percentage + planet->y_pos;
vecz = z*dist*percentage + planet->z_pos;
if ( z == -1 ) // To prevent divide by zero errors if a moon is straight north
{
data->orient1 = (float)0; // North
data->orient2 = (float)sqrt(1/2);
data->orient3 = (float)sqrt(1/2);
}
else
{
angle = acos(z)/2;
data->orient1 = (float)cos(angle);
data->orient2 = (float)(-y*cos(angle)/(z+1));
data->orient3 = (float)(x*cos(angle)/(z+1));
};
data->x_pos = vecx;
data->y_pos = vecy;
data->z_pos = vecz;
}
Please Log in or Create an account to join the conversation.
Re:
21 years 1 month ago
Cool! Nice job.
mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.
mailto:second_chance@cox.net
The Ultimate Guide To Modding: I-War 2 - Edge Of Chaos (on hold during SW MP mod)
cartoons.sev.com.au/index.php?catid=4
.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.