This site requires JavaScript, please enable it in your browser!
Greenfoot back
Moritz
Moritz wrote ...

2012/4/12

3D - short question

Moritz Moritz

2012/4/12

#
Hey, First: Sorry for my English - It is not so good =) So my problem: I wanted to ask if someone can tell me how hard it is to make the background a bit of 3d? In the way of this picture: http://gaming.justnetwork.eu/files/2012/01/sonic-generations_Screen4.jpg It should be just a little 3d! So the game is to have a bit of depth. I have a scroling background in my game and now I want to build a bridge like you can see in the picture. But the problem is that the blocks have to rotate, the further they are away from the center point. Is it difficult du do that - ? I have an Idea, but I am not sure if it is correct: I think I have to do many pictures form different views. And then I have to change the image the further the blogs are away from the center point ?? Thank you
nccb nccb

2012/4/12

#
It is possible to do, but requires a bit of maths. Essentially, you have an imaginary viewpoint behind the screen, looking through the screen at the blocks. To draw the blocks on the screen, you need to draw a line from the blocks to the viewpoint, and see where they touch the screen. I can't quite find the right diagram online, but imagine drawing a line from each vertex of the blocks through the viewport to the eye: The basic idea is to translate the "world" X-Y-Z coordinates to screen X-Y by multiplying the distance from the centre of the screen (in world coordinates) by viewport_depth/Z. (You can fiddle viewport_depth manually to find a good value). I don't have time right now to go into more depth though, so it's probably not much help...
Moritz Moritz

2012/4/12

#
thank you very much - I will try it - maybe there are some tutorials, too =))
dlanni dlanni

2012/4/13

#
I don't know if this will help, but I'm working on a similar project and have found a solution in "Scale". It's use is demonstrated in asteroids program's proton wave, using scaling the (one) image of an explosion larger and larger to create an effect very much like getting closer to something. I think this can be used simply, if you don't mind a central vanishing point. Look at danpost's 'Design Fun" for downloadable, very complex code that you can emulate to scale an image, and his new Kaliedascope, where you can chose a vanishing point by clicking with a mouse.
Moritz Moritz

2012/4/13

#
thank you =) but I donĀ“t find "design Fun" - I think you mean "fractal Fun" ?!
danpost danpost

2012/4/13

#
Sorry, I took 'Design fun' down when I got the implementation in 'Fractal Fun', which I then named 'Kaleidoscope'. I will put it back up so you can take a look at the code (I will add comments, first).
danpost danpost

2012/4/13

#
OK, 'Design fun' is back up. I included some comments with the source. I do not know if it will help you, Moritz, but have a look.
Moritz Moritz

2012/4/14

#
Yes I think It will help me =)) thank you =)
You need to login to post a reply.