[Technical stuff]
This is code that SHOULD place any "orbiting" asteroids/moons around the planet around an axis
Its like the currently used system but it has a hole in the middle ,for the planet, and is squished along a different plane
Code: Select all
float rotX = -1.0f * atan(axis.z/axis.y);
float rotZ = -1.0f * atan(axis.x/axis.y);
position = Vector::RandomDirection();
position.z *= lens;
position *= (radius - orbit - rThing) * pow(random(0.0f, 1.0f), 1.0f/3.0f) + (orbit + rThing);
float oldX = position.x;
float oldY = position.y;
float oldZ = position.z;
position.y = oldY * cos(rotX) - oldZ * sin(rotX);
position.z = oldY * sin(rotX) + oldZ * cos(rotX);
oldY = position.y;
position.x = oldX * cos(rotZ) - oldY * sin(rotZ);
position.y = oldX * sin(rotZ) + oldY * cos(rotZ);
axis is the axis they are placed around
position is a vector that represents the asteroids position
RandomDirection returns a random unit vector
lens is a value that squishes the position(that could be anywhere along the edge of a sphere) into a disk
radius is the sectors radius
orbit is the minimum distance I want the edge of a rock to be from origin
rThing is the radius of the asteroid
<<<Still knows nothing about vectors
If something doesn't look correct or you have a better way to do it tell me..K /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />
As for differentiating the plates from normal asteroids I have decided to use,instead of the 8th bit(my original plan) or just assigning them different values(Tigereye's suggestion), the last(first?) 4 bits, like an area code, similar to my original 8th bit plan, differently to verify wheter or not an asteroid/planet can be built on.
Example:
Code: Select all
[0000]0000 00010000 or 0x0010 (uranium asteroid)
[0001]0000 00010000 or 0x1010 (planetary uranium)
[0011]0000 00010000 or 0x3010 (some other "special" uranium)
currently a con for a U asteroid could only build on its own rock(which is good)
a con for a planetary u could also build on a U asteroid(not good because you have a landmass floating in space)
and a con for that other nonexistent U "thing" could be built on any of the others(same problem as above
If during verification we divide by 0x1000 and only allow cons, that would otherwise be able to build, with the same value to build those problems are eliminated and there is still ample room for future addition(a total of 16 sets of rocks with 12 rocks each, currently we only use 7 types)
Again, any comments would be appreciated as no actual coding has been done.
[/Technical stuff]