TruongPS
TruongPS

Reputation: 31

How can I set the Perspective Camera in game like the picture? (Engine libgdx)

I am new in 3D game? I am using Libgdx. How can I calculate params for Perspective Camera like Tetromino Revolution game? Please, give me any idea about that.

See the image: http://www.terminalstudio.com/screens/tetrisrev/big1.jpg

Upvotes: 2

Views: 5093

Answers (2)

TheWhiteLlama
TheWhiteLlama

Reputation: 1286

You could setup a camera like this:

float fieldOfView = 45;
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
PerspectiveCamera camera = new PerspectiveCamera(fieldOfView, 1, h/w);
camera.position.z = -2f; //just an example of camera displacement
camera.update();

The bigger the fieldOfView grows, the more perspective will be in your scenery. You can now put your blocks or something onto the x-y-plane and it will probably look similar.

I recommend you to read some tutorials first, to get into the feeling of 3D-programming. It seems as if there will be some other questions in your mind soon.

Upvotes: 2

Ben Poulson
Ben Poulson

Reputation: 3505

This is a great tutorial for what you need.

http://blog.xoppa.com/basic-3d-using-libgdx-2/

Upvotes: 3

Related Questions