Ok, just to try something new I decided to try to port a code for creation of a 3D cube in AGS. I am following this tutorial for processing (https://www.khanacademy.org/computer-programming/3d-tutorial-4/1648921303).
I am falling in a problem where I get a melting cube:
(https://i.imgur.com/xdYI3ZS.gif)
My code is below:
Spoiler
// new module script
//********************************************************
// * See tutorial at:
// * http://www.petercollingridge.appspot.com/3D-tutorial
//*********************************************************/
int backgroundColour;
int nodeColour;
int edgeColour;
int nodeSize;
int pmouseX;
int pmouseY;
int off_x;
int off_y;
DynamicSprite * SpriteScreen;
DrawingSurface * ScrSurf;
Overlay* myOverlay;
struct node{
int x;
int y;
int z;
};
struct edge{
int n0;
int n1;
};
#define NODESLENGTH 8
#define EDGESLENGTH 12
node nodes[NODESLENGTH];
edge edges[EDGESLENGTH];
void rotateZ3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int x = nodes[i].x;
int y = nodes[i].y;
nodes[i].x = FloatToInt(IntToFloat(x)*cos_t-IntToFloat(y)*sin_t);
nodes[i].y = FloatToInt(IntToFloat(y)*cos_t+IntToFloat(x)*sin_t);
i++;
}
}
void rotateY3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int x = nodes[i].x;
int z = nodes[i].z;
nodes[i].x = FloatToInt(IntToFloat(x)*cos_t-IntToFloat(z)*sin_t);
nodes[i].z = FloatToInt(IntToFloat(z)*cos_t+IntToFloat(x)*sin_t);
i++;
}
}
void rotateX3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int y = nodes[i].y;
int z = nodes[i].z;
nodes[i].y = FloatToInt(IntToFloat(y)*cos_t-IntToFloat(z)*sin_t);
nodes[i].z = FloatToInt(IntToFloat(z)*cos_t+IntToFloat(y)*sin_t);
i++;
}
}
void translate(int x, int y, int z) {
int i=0;
while(i<NODESLENGTH){
nodes[i].x=nodes[i].x+x;
nodes[i].y=nodes[i].y+y;
nodes[i].z=nodes[i].z+z;
i++;
}
}
void draw() {
ScrSurf = SpriteScreen.GetDrawingSurface();
ScrSurf.Clear(backgroundColour);
ScrSurf.DrawingColor=edgeColour;
int i=0;
while(i<EDGESLENGTH){
ScrSurf.DrawLine(nodes[edges[i].n0].x+off_x, nodes[edges[i].n0].y+off_y, nodes[edges[i].n1].x+off_x, nodes[edges[i].n1].y+off_y);
i++;
}
ScrSurf.DrawingColor=nodeColour;
i=0;
while(i<NODESLENGTH){
ScrSurf.DrawPixel(nodes[i].x+off_x, nodes[i].y+off_y);
i++;
}
ScrSurf.Release();
}
void mouseDragged() {
rotateY3D(IntToFloat(mouse.x - pmouseX));
rotateX3D(IntToFloat(mouse.y - pmouseY));
pmouseX=mouse.x;
pmouseY=mouse.y;
}
void autoRotate() {
rotateY3D(Maths.Pi/32.0);
rotateX3D(Maths.Pi/32.0);
}
void repeatedly_execute(){
//mouseDragged();
autoRotate();
draw();
myOverlay.Remove();
myOverlay = Overlay.CreateGraphical(0, 0, SpriteScreen.Graphic, true);
}
void game_start(){
backgroundColour = Game.GetColorFromRGB(255, 255, 255);
nodeColour = Game.GetColorFromRGB(40, 168, 107);
edgeColour = Game.GetColorFromRGB(34, 68, 204);
nodeSize = 8;
nodes[0].x= -25;
nodes[0].y= -25;
nodes[0].z= -25;
nodes[1].x= -25;
nodes[1].y= -25;
nodes[1].z= 25;
nodes[2].x= -25;
nodes[2].y= 25;
nodes[2].z= -25;
nodes[3].x= -25;
nodes[3].y= 25;
nodes[3].z= 25;
nodes[4].x= 25;
nodes[4].y= -25;
nodes[4].z= -25;
nodes[5].x= 25;
nodes[5].y= -25;
nodes[5].z= 25;
nodes[6].x= 25;
nodes[6].y= 25;
nodes[6].z= -25;
nodes[7].x= 25;
nodes[7].y= 25;
nodes[7].z= 25;
edges[0].n0= 0;
edges[0].n1= 1;
edges[1].n0= 1;
edges[1].n1= 3;
edges[2].n0= 3;
edges[2].n1= 2;
edges[3].n0= 2;
edges[3].n1= 0;
edges[4].n0= 4;
edges[4].n1= 5;
edges[5].n0= 5;
edges[5].n1= 7;
edges[6].n0= 7;
edges[6].n1= 6;
edges[7].n0= 6;
edges[7].n1= 4;
edges[8].n0= 0;
edges[8].n1= 4;
edges[9].n0= 1;
edges[9].n1= 5;
edges[10].n0= 2;
edges[10].n1= 6;
edges[11].n0= 3;
edges[11].n1= 7;
rotateZ3D(30.0);
rotateY3D(30.0);
rotateX3D(30.0);
translate(25, 25, 0);
SpriteScreen = DynamicSprite.Create(System.ViewportWidth, System.ViewportHeight, true);
myOverlay = Overlay.CreateGraphical(0, 0, SpriteScreen.Graphic, true);
off_x=100;
off_y=100;
}
AGS Project Download as zip here (https://ericoporto.github.io/public_html/sad3d/cube3D.zip)I think maybe this is due to rounding errors but I don't know how to prevent it. :/
To avoid having rounding errors grow like this, don't calculate each iteration based on the results of the last iteration, but instead based on the original values.
So instead of taking the rotated coordinates and rotating them again, add the two rotations together and use that to rotate the original coordinates.
(https://i.imgur.com/JH4sHVk.gif)
Hey thanks
@Snarky, it works!
Spoiler
// new module script
//********************************************************
// * See tutorial at:
// * http://www.petercollingridge.appspot.com/3D-tutorial
//*********************************************************/
int backgroundColour;
int nodeColour;
int edgeColour;
int nodeSize;
int pmouseX;
int pmouseY;
int off_x;
int off_y;
float acc_thetaX;
float acc_thetaY;
float acc_thetaZ;
DynamicSprite * SpriteScreen;
DrawingSurface * ScrSurf;
Overlay* myOverlay;
struct node{
int x;
int y;
int z;
};
struct edge{
int n0;
int n1;
};
#define NODESLENGTH 8
#define EDGESLENGTH 12
node original_nodes[NODESLENGTH];
node nodes[NODESLENGTH];
edge edges[EDGESLENGTH];
void rotateZ3D(float thetaZ){
acc_thetaZ=acc_thetaZ+thetaZ;
}
void rotateY3D(float thetaY){
acc_thetaY=acc_thetaY+thetaY;
}
void rotateX3D(float thetaX){
acc_thetaX=acc_thetaX+thetaX;
}
void doRotateZ3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int x = nodes[i].x;
int y = nodes[i].y;
nodes[i].x = FloatToInt(IntToFloat(x)*cos_t-IntToFloat(y)*sin_t);
nodes[i].y = FloatToInt(IntToFloat(y)*cos_t+IntToFloat(x)*sin_t);
i++;
}
}
void doRotateY3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int x = nodes[i].x;
int z = nodes[i].z;
nodes[i].x = FloatToInt(IntToFloat(x)*cos_t-IntToFloat(z)*sin_t);
nodes[i].z = FloatToInt(IntToFloat(z)*cos_t+IntToFloat(x)*sin_t);
i++;
}
}
void doRotateX3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int y = nodes[i].y;
int z = nodes[i].z;
nodes[i].y = FloatToInt(IntToFloat(y)*cos_t-IntToFloat(z)*sin_t);
nodes[i].z = FloatToInt(IntToFloat(z)*cos_t+IntToFloat(y)*sin_t);
i++;
}
}
void translate(int x, int y, int z) {
int i=0;
while(i<NODESLENGTH){
nodes[i].x=nodes[i].x+x;
nodes[i].y=nodes[i].y+y;
nodes[i].z=nodes[i].z+z;
i++;
}
}
void draw() {
ScrSurf = SpriteScreen.GetDrawingSurface();
ScrSurf.Clear(backgroundColour);
ScrSurf.DrawingColor=edgeColour;
int i=0;
while(i<EDGESLENGTH){
ScrSurf.DrawLine(nodes[edges[i].n0].x+off_x, nodes[edges[i].n0].y+off_y, nodes[edges[i].n1].x+off_x, nodes[edges[i].n1].y+off_y);
i++;
}
ScrSurf.DrawingColor=nodeColour;
i=0;
while(i<NODESLENGTH){
ScrSurf.DrawPixel(nodes[i].x+off_x, nodes[i].y+off_y);
i++;
}
ScrSurf.Release();
}
void mouseDragged() {
rotateY3D(IntToFloat(mouse.x - pmouseX));
rotateX3D(IntToFloat(mouse.y - pmouseY));
pmouseX=mouse.x;
pmouseY=mouse.y;
}
void autoRotate() {
rotateY3D(Maths.Pi/32.0);
rotateX3D(Maths.Pi/32.0);
}
void copyOriginalToNodes(){
int i=0;
while(i<NODESLENGTH){
nodes[i].x = original_nodes[i].x;
nodes[i].y = original_nodes[i].y;
nodes[i].z = original_nodes[i].z;
i++;
}
}
void repeatedly_execute(){
//mouseDragged();
copyOriginalToNodes();
autoRotate();
doRotateX3D(acc_thetaX);
doRotateY3D(acc_thetaY);
doRotateZ3D(acc_thetaZ);
draw();
myOverlay.Remove();
myOverlay = Overlay.CreateGraphical(0, 0, SpriteScreen.Graphic, true);
}
void game_start(){
backgroundColour = Game.GetColorFromRGB(255, 255, 255);
nodeColour = Game.GetColorFromRGB(40, 168, 107);
edgeColour = Game.GetColorFromRGB(34, 68, 204);
nodeSize = 8;
original_nodes[0].x= -25;
original_nodes[0].y= -25;
original_nodes[0].z= -25;
original_nodes[1].x= -25;
original_nodes[1].y= -25;
original_nodes[1].z= 25;
original_nodes[2].x= -25;
original_nodes[2].y= 25;
original_nodes[2].z= -25;
original_nodes[3].x= -25;
original_nodes[3].y= 25;
original_nodes[3].z= 25;
original_nodes[4].x= 25;
original_nodes[4].y= -25;
original_nodes[4].z= -25;
original_nodes[5].x= 25;
original_nodes[5].y= -25;
original_nodes[5].z= 25;
original_nodes[6].x= 25;
original_nodes[6].y= 25;
original_nodes[6].z= -25;
original_nodes[7].x= 25;
original_nodes[7].y= 25;
original_nodes[7].z= 25;
copyOriginalToNodes();
edges[0].n0= 0;
edges[0].n1= 1;
edges[1].n0= 1;
edges[1].n1= 3;
edges[2].n0= 3;
edges[2].n1= 2;
edges[3].n0= 2;
edges[3].n1= 0;
edges[4].n0= 4;
edges[4].n1= 5;
edges[5].n0= 5;
edges[5].n1= 7;
edges[6].n0= 7;
edges[6].n1= 6;
edges[7].n0= 6;
edges[7].n1= 4;
edges[8].n0= 0;
edges[8].n1= 4;
edges[9].n0= 1;
edges[9].n1= 5;
edges[10].n0= 2;
edges[10].n1= 6;
edges[11].n0= 3;
edges[11].n1= 7;
rotateZ3D(30.0);
rotateY3D(30.0);
rotateX3D(30.0);
translate(25, 25, 0);
SpriteScreen = DynamicSprite.Create(System.ViewportWidth, System.ViewportHeight, true);
myOverlay = Overlay.CreateGraphical(0, 0, SpriteScreen.Graphic, true);
off_x=100;
off_y=100;
}
I wouldn't mind a jelly cube.
(https://i.imgur.com/2fBhHDm.gif)
Did a cube like blue cup... :]
Drew in Wings3D, exported to .obj, used wavefront-obj-parser (https://www.npmjs.com/package/wavefront-obj-parser) from npm and some bits of js to convert:
Spoiler
mugobj = JSON.parse(wavefront-obj-output);
maxVxPs = mugobj.vertexPositions.length/3;
for(var i=0;i<maxVxPs;i++){
console.log("original_nodes["+i+"].x="+Math.round(mugobj.vertexPositions[i*3]*25)+";");
console.log("original_nodes["+i+"].y="+Math.round(mugobj.vertexPositions[i*3+1]*25)+";");
console.log("original_nodes["+i+"].z="+Math.round(mugobj.vertexPositions[i*3+2]*25)+";");
}
maxVxPsI = mugobj.vertexPositionIndices.length/4;
for(var i=0;i<maxVxPsI;i++){
console.log("edges["+(i*4)+"].n0="+mugobj.vertexPositionIndices[i*4]+";");
console.log("edges["+(i*4)+"].n1="+mugobj.vertexPositionIndices[i*4+1]+";");
console.log("edges["+(i*4+1)+"].n0="+mugobj.vertexPositionIndices[i*4+1]+";");
console.log("edges["+(i*4+1)+"].n1="+mugobj.vertexPositionIndices[i*4+2]+";");
console.log("edges["+(i*4+2)+"].n0="+mugobj.vertexPositionIndices[i*4+2]+";");
console.log("edges["+(i*4+2)+"].n1="+mugobj.vertexPositionIndices[i*4+3]+";");
console.log("edges["+(i*4+3)+"].n0="+mugobj.vertexPositionIndices[i*4+3]+";");
console.log("edges["+(i*4+3)+"].n1="+mugobj.vertexPositionIndices[i*4]+";");
}
Resulting code here
Spoiler
// new module script
//********************************************************
// * See tutorial at:
// * http://www.petercollingridge.appspot.com/3D-tutorial
//*********************************************************/
int backgroundColour;
int nodeColour;
int edgeColour;
int nodeSize;
int pmouseX;
int pmouseY;
int off_x;
int off_y;
float acc_thetaX;
float acc_thetaY;
float acc_thetaZ;
DynamicSprite * SpriteScreen;
DrawingSurface * ScrSurf;
Overlay* myOverlay;
struct node{
int x;
int y;
int z;
};
struct edge{
int n0;
int n1;
};
#define NODESLENGTH 40
#define EDGESLENGTH 136
node original_nodes[NODESLENGTH];
node nodes[NODESLENGTH];
edge edges[EDGESLENGTH];
void rotateZ3D(float thetaZ){
acc_thetaZ=acc_thetaZ+thetaZ;
}
void rotateY3D(float thetaY){
acc_thetaY=acc_thetaY+thetaY;
}
void rotateX3D(float thetaX){
acc_thetaX=acc_thetaX+thetaX;
}
void doRotateZ3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int x = nodes[i].x;
int y = nodes[i].y;
nodes[i].x = FloatToInt(IntToFloat(x)*cos_t-IntToFloat(y)*sin_t);
nodes[i].y = FloatToInt(IntToFloat(y)*cos_t+IntToFloat(x)*sin_t);
i++;
}
}
void doRotateY3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int x = nodes[i].x;
int z = nodes[i].z;
nodes[i].x = FloatToInt(IntToFloat(x)*cos_t-IntToFloat(z)*sin_t);
nodes[i].z = FloatToInt(IntToFloat(z)*cos_t+IntToFloat(x)*sin_t);
i++;
}
}
void doRotateX3D(float theta) {
float sin_t = Maths.Sin(theta);
float cos_t = Maths.Cos(theta);
int i=0;
while(i<NODESLENGTH){
int y = nodes[i].y;
int z = nodes[i].z;
nodes[i].y = FloatToInt(IntToFloat(y)*cos_t-IntToFloat(z)*sin_t);
nodes[i].z = FloatToInt(IntToFloat(z)*cos_t+IntToFloat(y)*sin_t);
i++;
}
}
void translate(int x, int y, int z) {
int i=0;
while(i<NODESLENGTH){
nodes[i].x=nodes[i].x+x;
nodes[i].y=nodes[i].y+y;
nodes[i].z=nodes[i].z+z;
i++;
}
}
void draw() {
ScrSurf = SpriteScreen.GetDrawingSurface();
ScrSurf.Clear(backgroundColour);
ScrSurf.DrawingColor=edgeColour;
int i=0;
while(i<EDGESLENGTH){
ScrSurf.DrawLine(nodes[edges[i].n0].x+off_x, nodes[edges[i].n0].y+off_y, nodes[edges[i].n1].x+off_x, nodes[edges[i].n1].y+off_y);
i++;
}
ScrSurf.DrawingColor=nodeColour;
i=0;
while(i<NODESLENGTH){
ScrSurf.DrawPixel(nodes[i].x+off_x, nodes[i].y+off_y);
i++;
}
ScrSurf.Release();
}
void mouseDragged() {
rotateY3D(IntToFloat(mouse.x - pmouseX)/20.0);
rotateX3D(IntToFloat(mouse.y - pmouseY)/20.0);
pmouseX=mouse.x;
pmouseY=mouse.y;
}
void autoRotate() {
rotateY3D(Maths.Pi/32.0);
rotateX3D(Maths.Pi/32.0);
}
void copyOriginalToNodes(){
int i=0;
while(i<NODESLENGTH){
nodes[i].x = original_nodes[i].x;
nodes[i].y = original_nodes[i].y;
nodes[i].z = original_nodes[i].z;
i++;
}
}
void repeatedly_execute(){
mouseDragged();
copyOriginalToNodes();
//autoRotate();
doRotateX3D(acc_thetaX);
doRotateY3D(acc_thetaY);
doRotateZ3D(acc_thetaZ);
draw();
myOverlay.Remove();
myOverlay = Overlay.CreateGraphical(0, 0, SpriteScreen.Graphic, true);
}
void game_start(){
backgroundColour = Game.GetColorFromRGB(255, 255, 255);
nodeColour = Game.GetColorFromRGB(40, 168, 107);
edgeColour = Game.GetColorFromRGB(34, 68, 204);
nodeSize = 8;
original_nodes[0].x=-8;
original_nodes[0].y=-23;
original_nodes[0].z=25;
original_nodes[1].x=-8;
original_nodes[1].y=-23;
original_nodes[1].z=41;
original_nodes[2].x=-8;
original_nodes[2].y=-7;
original_nodes[2].z=25;
original_nodes[3].x=-8;
original_nodes[3].y=-7;
original_nodes[3].z=41;
original_nodes[4].x=8;
original_nodes[4].y=-23;
original_nodes[4].z=25;
original_nodes[5].x=8;
original_nodes[5].y=-23;
original_nodes[5].z=41;
original_nodes[6].x=8;
original_nodes[6].y=-7;
original_nodes[6].z=25;
original_nodes[7].x=8;
original_nodes[7].y=-7;
original_nodes[7].z=41;
original_nodes[8].x=-8;
original_nodes[8].y=8;
original_nodes[8].z=24;
original_nodes[9].x=-8;
original_nodes[9].y=8;
original_nodes[9].z=40;
original_nodes[10].x=-8;
original_nodes[10].y=24;
original_nodes[10].z=24;
original_nodes[11].x=-8;
original_nodes[11].y=24;
original_nodes[11].z=40;
original_nodes[12].x=8;
original_nodes[12].y=8;
original_nodes[12].z=24;
original_nodes[13].x=8;
original_nodes[13].y=8;
original_nodes[13].z=40;
original_nodes[14].x=8;
original_nodes[14].y=24;
original_nodes[14].z=24;
original_nodes[15].x=8;
original_nodes[15].y=24;
original_nodes[15].z=40;
original_nodes[16].x=-8;
original_nodes[16].y=24;
original_nodes[16].z=57;
original_nodes[17].x=-8;
original_nodes[17].y=8;
original_nodes[17].z=57;
original_nodes[18].x=8;
original_nodes[18].y=8;
original_nodes[18].z=57;
original_nodes[19].x=8;
original_nodes[19].y=24;
original_nodes[19].z=57;
original_nodes[20].x=-8;
original_nodes[20].y=-23;
original_nodes[20].z=40;
original_nodes[21].x=8;
original_nodes[21].y=-23;
original_nodes[21].z=40;
original_nodes[22].x=8;
original_nodes[22].y=-23;
original_nodes[22].z=57;
original_nodes[23].x=-8;
original_nodes[23].y=-23;
original_nodes[23].z=57;
original_nodes[24].x=-25;
original_nodes[24].y=-25;
original_nodes[24].z=-25;
original_nodes[25].x=-25;
original_nodes[25].y=-25;
original_nodes[25].z=25;
original_nodes[26].x=-25;
original_nodes[26].y=25;
original_nodes[26].z=-25;
original_nodes[27].x=-25;
original_nodes[27].y=25;
original_nodes[27].z=25;
original_nodes[28].x=25;
original_nodes[28].y=-25;
original_nodes[28].z=-25;
original_nodes[29].x=25;
original_nodes[29].y=-25;
original_nodes[29].z=25;
original_nodes[30].x=25;
original_nodes[30].y=25;
original_nodes[30].z=-25;
original_nodes[31].x=25;
original_nodes[31].y=25;
original_nodes[31].z=25;
original_nodes[32].x=-17;
original_nodes[32].y=25;
original_nodes[32].z=-17;
original_nodes[33].x=-17;
original_nodes[33].y=25;
original_nodes[33].z=17;
original_nodes[34].x=17;
original_nodes[34].y=25;
original_nodes[34].z=17;
original_nodes[35].x=17;
original_nodes[35].y=25;
original_nodes[35].z=-17;
original_nodes[36].x=-17;
original_nodes[36].y=-8;
original_nodes[36].z=-17;
original_nodes[37].x=-17;
original_nodes[37].y=-8;
original_nodes[37].z=17;
original_nodes[38].x=17;
original_nodes[38].y=-8;
original_nodes[38].z=17;
original_nodes[39].x=17;
original_nodes[39].y=-8;
original_nodes[39].z=-17;
edges[0].n0=0;
edges[0].n1=4;
edges[1].n0=4;
edges[1].n1=5;
edges[2].n0=5;
edges[2].n1=1;
edges[3].n0=1;
edges[3].n1=0;
edges[4].n0=1;
edges[4].n1=3;
edges[5].n0=3;
edges[5].n1=2;
edges[6].n0=2;
edges[6].n1=0;
edges[7].n0=0;
edges[7].n1=1;
edges[8].n0=1;
edges[8].n1=5;
edges[9].n0=5;
edges[9].n1=7;
edges[10].n0=7;
edges[10].n1=3;
edges[11].n0=3;
edges[11].n1=1;
edges[12].n0=2;
edges[12].n1=6;
edges[13].n0=6;
edges[13].n1=4;
edges[14].n0=4;
edges[14].n1=0;
edges[15].n0=0;
edges[15].n1=2;
edges[16].n0=3;
edges[16].n1=7;
edges[17].n0=7;
edges[17].n1=6;
edges[18].n0=6;
edges[18].n1=2;
edges[19].n0=2;
edges[19].n1=3;
edges[20].n0=4;
edges[20].n1=6;
edges[21].n0=6;
edges[21].n1=7;
edges[22].n0=7;
edges[22].n1=5;
edges[23].n0=5;
edges[23].n1=4;
edges[24].n0=8;
edges[24].n1=12;
edges[25].n0=12;
edges[25].n1=13;
edges[26].n0=13;
edges[26].n1=9;
edges[27].n0=9;
edges[27].n1=8;
edges[28].n0=9;
edges[28].n1=11;
edges[29].n0=11;
edges[29].n1=10;
edges[30].n0=10;
edges[30].n1=8;
edges[31].n0=8;
edges[31].n1=9;
edges[32].n0=9;
edges[32].n1=17;
edges[33].n0=17;
edges[33].n1=16;
edges[34].n0=16;
edges[34].n1=11;
edges[35].n0=11;
edges[35].n1=9;
edges[36].n0=9;
edges[36].n1=20;
edges[37].n0=20;
edges[37].n1=23;
edges[38].n0=23;
edges[38].n1=17;
edges[39].n0=17;
edges[39].n1=9;
edges[40].n0=10;
edges[40].n1=14;
edges[41].n0=14;
edges[41].n1=12;
edges[42].n0=12;
edges[42].n1=8;
edges[43].n0=8;
edges[43].n1=10;
edges[44].n0=11;
edges[44].n1=15;
edges[45].n0=15;
edges[45].n1=14;
edges[46].n0=14;
edges[46].n1=10;
edges[47].n0=10;
edges[47].n1=11;
edges[48].n0=11;
edges[48].n1=16;
edges[49].n0=16;
edges[49].n1=19;
edges[50].n0=19;
edges[50].n1=15;
edges[51].n0=15;
edges[51].n1=11;
edges[52].n0=12;
edges[52].n1=14;
edges[53].n0=14;
edges[53].n1=15;
edges[54].n0=15;
edges[54].n1=13;
edges[55].n0=13;
edges[55].n1=12;
edges[56].n0=13;
edges[56].n1=21;
edges[57].n0=21;
edges[57].n1=20;
edges[58].n0=20;
edges[58].n1=9;
edges[59].n0=9;
edges[59].n1=13;
edges[60].n0=15;
edges[60].n1=19;
edges[61].n0=19;
edges[61].n1=18;
edges[62].n0=18;
edges[62].n1=13;
edges[63].n0=13;
edges[63].n1=15;
edges[64].n0=17;
edges[64].n1=18;
edges[65].n0=18;
edges[65].n1=19;
edges[66].n0=19;
edges[66].n1=16;
edges[67].n0=16;
edges[67].n1=17;
edges[68].n0=17;
edges[68].n1=23;
edges[69].n0=23;
edges[69].n1=22;
edges[70].n0=22;
edges[70].n1=18;
edges[71].n0=18;
edges[71].n1=17;
edges[72].n0=18;
edges[72].n1=22;
edges[73].n0=22;
edges[73].n1=21;
edges[74].n0=21;
edges[74].n1=13;
edges[75].n0=13;
edges[75].n1=18;
edges[76].n0=21;
edges[76].n1=22;
edges[77].n0=22;
edges[77].n1=23;
edges[78].n0=23;
edges[78].n1=20;
edges[79].n0=20;
edges[79].n1=21;
edges[80].n0=24;
edges[80].n1=28;
edges[81].n0=28;
edges[81].n1=29;
edges[82].n0=29;
edges[82].n1=25;
edges[83].n0=25;
edges[83].n1=24;
edges[84].n0=25;
edges[84].n1=27;
edges[85].n0=27;
edges[85].n1=26;
edges[86].n0=26;
edges[86].n1=24;
edges[87].n0=24;
edges[87].n1=25;
edges[88].n0=25;
edges[88].n1=29;
edges[89].n0=29;
edges[89].n1=31;
edges[90].n0=31;
edges[90].n1=27;
edges[91].n0=27;
edges[91].n1=25;
edges[92].n0=26;
edges[92].n1=30;
edges[93].n0=30;
edges[93].n1=28;
edges[94].n0=28;
edges[94].n1=24;
edges[95].n0=24;
edges[95].n1=26;
edges[96].n0=26;
edges[96].n1=32;
edges[97].n0=32;
edges[97].n1=35;
edges[98].n0=35;
edges[98].n1=30;
edges[99].n0=30;
edges[99].n1=26;
edges[100].n0=27;
edges[100].n1=33;
edges[101].n0=33;
edges[101].n1=32;
edges[102].n0=32;
edges[102].n1=26;
edges[103].n0=26;
edges[103].n1=27;
edges[104].n0=28;
edges[104].n1=30;
edges[105].n0=30;
edges[105].n1=31;
edges[106].n0=31;
edges[106].n1=29;
edges[107].n0=29;
edges[107].n1=28;
edges[108].n0=30;
edges[108].n1=35;
edges[109].n0=35;
edges[109].n1=34;
edges[110].n0=34;
edges[110].n1=31;
edges[111].n0=31;
edges[111].n1=30;
edges[112].n0=31;
edges[112].n1=34;
edges[113].n0=34;
edges[113].n1=33;
edges[114].n0=33;
edges[114].n1=27;
edges[115].n0=27;
edges[115].n1=31;
edges[116].n0=32;
edges[116].n1=36;
edges[117].n0=36;
edges[117].n1=39;
edges[118].n0=39;
edges[118].n1=35;
edges[119].n0=35;
edges[119].n1=32;
edges[120].n0=33;
edges[120].n1=37;
edges[121].n0=37;
edges[121].n1=36;
edges[122].n0=36;
edges[122].n1=32;
edges[123].n0=32;
edges[123].n1=33;
edges[124].n0=34;
edges[124].n1=38;
edges[125].n0=38;
edges[125].n1=37;
edges[126].n0=37;
edges[126].n1=33;
edges[127].n0=33;
edges[127].n1=34;
edges[128].n0=35;
edges[128].n1=39;
edges[129].n0=39;
edges[129].n1=38;
edges[130].n0=38;
edges[130].n1=34;
edges[131].n0=34;
edges[131].n1=35;
edges[132].n0=37;
edges[132].n1=38;
edges[133].n0=38;
edges[133].n1=39;
edges[134].n0=39;
edges[134].n1=36;
edges[135].n0=36;
edges[135].n1=37;
copyOriginalToNodes();
rotateZ3D(30.0);
rotateY3D(30.0);
rotateX3D(30.0);
translate(25, 25, 0);
SpriteScreen = DynamicSprite.Create(System.ViewportWidth, System.ViewportHeight, true);
myOverlay = Overlay.CreateGraphical(0, 0, SpriteScreen.Graphic, true);
off_x=100;
off_y=100;
}
Really cool.
You can find an AGS paint (aka "flood fill") algorithm in this module : http://www.adventuregamestudio.co.uk/forums/index.php?topic=51142.0 (for credit: algorithm stolen from another, older module).
This way now you can start coloring and shading faces ;)
Quote from: Monsieur OUXX on Mon 09/10/2017 08:58:23
This way now you can start coloring and shading faces ;)
Wireframe is much more science fiction.
Glad you got it working. Looks cool!
Quote from: ClickClickClick on Mon 09/10/2017 09:36:39
Quote from: Monsieur OUXX on Mon 09/10/2017 08:58:23
This way now you can start coloring and shading faces ;)
Wireframe is much more science fiction.
Yeah but he could make the "rotating cube verbcoin interface" from Cryo's Lost Eden and make it a module for the community ;)
Very cool!
I consider using it for a small project :)
However, it crashes the game when you change room:
QuoteError: scriptOverlay::Remove: overlay is not there!
It's easily solved by replacing this line in your code:
myOverlay.Remove();
with this one:
if ((myOverlay.Valid)== 1) myOverlay.Remove();