Basic 3D using LibGDX

Source: Internet
Author: User
Tags libgdx

Then we set the camera ten units to the right, and units up and ten units back.

public class Basic3dtest implements Applicationlistener {public
    perspectivecamera cam;

    @Override public
    Void Create () {
        cam = new Perspectivecamera (Gdx.graphics.getWidth (), Gdx.graphics.getHeight ());
        Cam.position.set (10f, 10f, 10f);//x right positive y upward for positive z want to be positive
        Cam.lookat (0,0,0);
        Cam.near = 1f;
        Cam.far = 300f;
        Cam.update ();
    }
...
}

Here we create a new perectivecamera with a field of view of degrees (which are common to use) and we set the aspect rat Io to the current width and height. Then we set the camera ten units to the right, and units up and ten units back. The z axis is pointing towards the viewer and so for the viewer a positive Z value of the camera was moving the viewer back. We set the camera to look at (0,0,0) because, where we are placing our 3D object to view. We set the "near" and "far" values to make sure we would always see our object. And finally we update the camera so all changes we made is reflected by the camera.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.