Java-Gaming.org Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (612)
Games in Android Showcase (172)
games submitted by our members
Games in WIP (658)
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 477 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: 162
Projects: 5
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  
 
 
You cannot reply to this message, because it is very, very old.

 
afikri (11 views)
2015-08-31 09:30:22

afikri (18 views)
2015-08-31 09:30:07

afikri (8 views)
2015-08-31 09:27:24

afikri (12 views)
2015-08-31 09:26:40

Roquen (16 views)
2015-08-29 11:30:54

GamerC4 (30 views)
2015-08-22 20:38:50

GamerC4 (26 views)
2015-08-22 20:37:18

GamerC4 (30 views)
2015-08-22 20:37:01

Kefwar (39 views)
2015-08-22 18:07:24

GamerC4 (26 views)
2015-08-22 01:00:24
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30
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!