# How do I do simple 3D? (the cube is done already, see demo)

Get help using Construct 2

### » Sun May 24, 2015 12:05 pm

Hello, dear Construct2 experts!
I've just made simple pseudo-3d example (the idea was found on a forum, thank you!).
Here is the DEMO: http://arte-code.com/3dT/index.html

I want to know is it possible to rotate and scale "vertical" lines of that cube with single function, regardless of line's count? I want to make a complex structure that way and don't want to make event changes manually.

I am attaching a .capx to my question: http://arte-code.com/3dT/top3d_lines.capx
B
9
S
2
G
1
Posts: 36
Reputation: 712

### » Mon May 25, 2015 11:24 am

Well, I'll consider that silence as a proof that there are no shortcuts in the gamedev ^_^
B
9
S
2
G
1
Posts: 36
Reputation: 712

### » Mon May 25, 2015 8:07 pm

Sure there is, it's called math.

The normal way to manipulate 3d points is to just change around the x, y, and z values to transform them. Then you use a perspective transform to map them to the screen.

You can read about vectors and matrices for the nitty gritty of the math.

To move you can just add numbers to the position to move them.
To rotate look up 2d rotation for a formula to do it.
Scaling is just a matter of multiplying the position by some values.

For rotation and scaling it's always done around the center 0,0,0. To do it around some other point you need to first move everything over so the rotation point is 0 then after that move the points back be the same amount.

Perspective in it's basic form is just dividing the x and y by the z.

You can look around the forum for a few examples. Search for "pseudo 3d" with my username for some various examples. There's also some examples in the tutorials.
B
101
S
39
G
134
Posts: 5,588
Reputation: 85,514

### » Tue May 26, 2015 4:46 am

Thank you, R0J0hound! You're an awesome man! Almost every mathematician is an awesome man, as I think ^_^
I found your examples and I'm looking in awe at them, they're giving me shivers actually.
But I can't count them as shortcuts, they're full-featured math problems (as for me). Nevertheless, thank you so much for your sole existence and will to help such dark creatures like myself ^_^
B
9
S
2
G
1
Posts: 36
Reputation: 712