Tutorial; MappingBasicShapes - HWRM/KarosGraveyard GitHub Wiki

How to Make Resource Patches in Simple Shapes by Mikali

I've created some functions that allow you to create simply shaped RU patches. I've made the variables to be similar to those used by HW1. So, if you have experience making maps for HW1, this will be a lot easier for you.

In the functions below, replace the #'s with the desired numerical values. ru is the number of asteroids. type is the type of asteroid, e.g. "Asteroid_2". posX, posZ, and posY are the coordinates of the patch's center. rotY and rotZ are the angles of rotation around, firstly, the Y-axis and, secondly, the Z-axis (the object is rotated around the Y-axis first, and the Z-axis second). The other variables should be self-explanatory.

Basic Shape Functions

Cylinders:

ru = #; type = "Text";
radiusInner = #; radiusOuter = #; height = #;
posX = #; posZ = #; posY = #; rotY = #; rotZ = #;

for i = 0, ru, 1 do
r = random(radiusInner, radiusOuter); v = random(0, 360); h = random(-1*height, height);
addAsteroid(type, {posX + cos(rotZ)*(sin(rotY)*h+cos(rotY)*r*cos(v))-sin(rotZ)*r*sin(v), posZ + cos(rotY)*h-sin(rotY)*r*cos(v), posY + sin(rotZ)*(sin(rotY)*h+cos(rotY)*r*cos(v))+cos(rotZ)*r*sin(v)}, 100, 0, 0, 0, 0);
end

Spheres:

ru = #; type = "Text";
radiusInner = #; radiusOuter = #;
posX = #; posZ = #; posY = #;

for i = 0, ru, 1 do
r = random(radiusInner, radiusOuter); ø = random(0, 180); Ø = random(0, 360);
addAsteroid(type, {posX + sqrt(r^2-(r*cos(ø))^2)*cos(Ø), posZ + r*cos(ø), posY + sqrt(r^2-(r*cos(ø))^2)*sin(Ø)}, 100, 0, 0, 0, 0);
end

Boxes:

ru = #; type = "Text";
length = #; height = #; width = #;
posX = #; posZ = #; posY = #; rotY = #; rotZ = #;

for i = 0, ru, 1 do
l = random(-1*length, length); w = random(-1*width, width); h = random(-1*height, height);
addAsteroid(type, {posX + cos(rotZ)*(sin(rotY)*h+cos(rotY)*l)-sin(rotZ)*w, posY + cos(rotY)*h-sin(rotY)*l, posZ + sin(rotZ)*(sin(rotY)*h+cos(rotY)*l)+cos(rotZ)*w}, 100, 0, 0, 0, 0);
end

Unified Function

I have also created a unified function that performs all of the same functions as those above.
Read about it here.

Discussion:

Related Pages

Tutorials

Comments

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial