Question: How do I set up a top-down view

I’m pretty sure this is a very stupid mistake I’m taking, but is there a way to make it so the view of the camera looks just like if you didn’t setup 3D functions? So I want to draw be able to a square before setting up 3D, then draw it after setting up the camera and it’d look the same

you can either draw the square before you tell Codea to draw in 3D with


or when you’re finished drawing in 3D, type


to convert back to 2D drawing, then draw your rect

@Ignatz - Sorry for the misundersanding. I was wanting to be able to make something like a top-down view app with simple 3D effect, but when I apply my perspective, I can’t get it to display everything in the position it would be without perspective.

@Zoyt - try setting your field of view (with the perspective command) to something small (e.g. between 1 and 10) and move your camera back really far in your vertical axis (i.e. y) until you can reframe everything to match your original ‘non-perspective’ position(s)

For very small FoV values this will simulate an ortho view using the perspective camera.

@Zoyt, your wanting a program, where some things are somewhat side view, but some are just from the top?

For example, lets say I’m making a racing game, and when I go under the bridge, I can see the sides of it, or I could see the front of buildings. Is that correct?

@Prynok - I’m not aiming for a game, but if I was, think of a top-down view like Slingshot Racing. You can tell it’s 3D but there camera doesn’t move and is always above.

@andymac3d, @Prynok - I got it working (my stupidity, as usual). Set the perspective to perspective(42, WIDTH/HEIGHT) and the camera to camera(0,0,-1000,0,0,0,0,1,0). After that, say scale(-1,1,1_ and then translate(-WIDTH/2,-HEIGHT/2).

Odd… For me I do camera(WIDTH / 2, HEIGHT / 2, -WIDTH + 100, WIDTH / 2, HEIGHT / 2, 0).

You only need to call perspective() if you changed it before.

@SkyTheCoder - Thanks. With some alterations, I got it to work for me.