Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [Libgdx] model isometric camera  (Read 190 times)
0 Members and 1 Guest are viewing this topic.
Offline trollwarrior1
« Posted 2014-06-10 18:04:31 »

I followed this tutorial (http://www.gamefromscratch.com/post/2014/01/19/3D-models-and-animation-from-Blender-to-LibGDX.aspx) and I got to this point:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
public class Game {

   public static Game instance;

   private SpriteBatch batch;

   public static float time = 0;

   private Level level;

   private PerspectiveCamera camera;
   private ModelBatch modelBatch;
   private Model model;
   private ModelInstance modelInstance;
   private Environment environment;
   private AnimationController controller;

   public Game() {

      batch = new SpriteBatch();

      level = new Level(50, 50);

      camera = new PerspectiveCamera(70, 640, 480);
     
      vec2 pos = Rotation.point(new vec2(0,0), new vec2(0, -10), 45);
     
     
      System.out.println(pos.x+"  "+pos.y);
     
//      camera.position.set(pos.x, pos.x, -pos.y + pos.y);
      camera.position.set(pos.x, pos.x, -pos.y);
      camera.lookAt(0, 0, 0);

      camera.near = 0.1f;
      camera.far = 1000f;
     
     
     
      modelBatch = new ModelBatch();

      UBJsonReader jsonReader = new UBJsonReader();
      G3dModelLoader modelLoader = new G3dModelLoader(jsonReader);

      model = modelLoader.loadModel(Gdx.files.internal("3d/cube.g3db"));
      modelInstance = new ModelInstance(model);

//      modelInstance.transform.rotate(1, 0, 0, 90);

      environment = new Environment();
      environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.8f, 0.8f, 0.8f, 1.0f));

      controller = new AnimationController(modelInstance);

//      onAnimationFinnished();

   }
   
   private void onAnimationFinnished() {
      controller.queue("Move", 100, 1f, new AnimationListener() {
         public void onLoop(AnimationDesc animation) {
           
         }
         
         public void onEnd(AnimationDesc animation) {
            onAnimationFinnished();
         }
      }, 10f);
     
   }

   public void tick() {
   }

   public void render() {

//      modelInstance.transform.rotate(1,0,0,1);

      controller.update(Gdx.graphics.getDeltaTime());

     
      time++;

      level.tick();
      level.render(batch);

      Gdx.gl20.glClear(GL20.GL_DEPTH_BUFFER_BIT);

      camera.update();

      modelBatch.begin(camera);
      modelBatch.render(modelInstance, environment);
      modelBatch.end();
   }

}


Everything works fine, but I want to replace perspective camera with isometric camera. Any ideas how I would go about doing that?
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 136
Projects: 4
Exp: 3 years



« Reply #1 - Posted 2014-06-10 18:06:37 »

Just replace the PerspectiveCamera with a rotated OrthographicCamera...
Offline trollwarrior1
« Reply #2 - Posted 2014-06-10 18:10:50 »

Hmm. I thought I could go around without modifying matrices myself. Guess not.
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (49 views)
2014-10-17 03:59:02

Norakomi (38 views)
2014-10-16 15:22:06

Norakomi (31 views)
2014-10-16 15:20:20

lcass (34 views)
2014-10-15 16:18:58

TehJavaDev (65 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (54 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!