### Author Topic: Strange coordinate system  (Read 1663 times)

#### mustafa1991

• byte
• Posts: 3
##### Strange coordinate system
« on: July 25, 2011, 11:45:50 pm »
First the coordinate system is upside-down
This is not the main problem, I can deal with that.

The problem is that I want to create a row of cubes
like this: (+ = cube)

+++++

Code: [Select]
`for(int i=0; i<5; i++) { Object3D cube = Primitives.getCube(10f); cube.translate(i*30, 0, 0); cube.build(); world.addObject(cube);}`
I get a strange row of cubes, I get something like this:

+
+
+
+
+

Why does this happen I translated them on the X axis, I tried the other axis same thing but in other directions
I didn't rotate anything!

#### EgonOlsen

• Administrator
• quad
• Posts: 12110
##### Re: Strange coordinate system
« Reply #1 on: July 25, 2011, 11:48:54 pm »
The coordinate system is as much upside down as any other. It's just uncommon...but apart from that, you must be doing something strange. Are you sure that you are looking at your scene from the right angle?

#### mustafa1991

• byte
• Posts: 3
##### Re: Strange coordinate system
« Reply #2 on: July 26, 2011, 01:04:54 am »
The coordinate system is as much upside down as any other. It's just uncommon...but apart from that, you must be doing something strange. Are you sure that you are looking at your scene from the right angle?

Thanks for replying

Well, here is a demo I simplified the program to be one Java file, so you can test it if you want to.

Code: [Select]
`import java.awt.Color;import javax.swing.JFrame;import com.threed.jpct.*;public class Game { private JFrame frame; private FrameBuffer buffer; private World world; public static void main(String[] args) { new Game().loop(); } public Game() { frame = new JFrame("Game"); frame.setSize(800, 600); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); world = new World(); // create cubes Object3D cube = null; for(int i=0; i<5; i++) { cube = Primitives.getCube(10f); cube.translate(i*30, 0, 0); cube.build(); world.addObject(cube); }                 // camera angle 1 //world.getCamera().setPosition(50, 0, -150); // you can uncomment this and comment the next to lines for an other anlge                 // camera angle 2 world.getCamera().setPosition(50, -150, 50); world.getCamera().rotateCameraX(90f); } private void loop() { buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL); while(frame.isShowing()) { buffer.clear(Color.BLUE); world.renderScene(buffer); world.draw(buffer); buffer.update(); buffer.display(frame.getGraphics()); try { Thread.sleep(10); } catch (InterruptedException e) {} } buffer.disableRenderer(IRenderer.RENDERER_OPENGL); buffer.dispose(); frame.dispose(); System.exit(0); }}`
Do I have the right angle?
I didn't rotate the cubes, did I rotate them somehow in my code?

#### EgonOlsen

• Administrator
• quad
• Posts: 12110
##### Re: Strange coordinate system
« Reply #3 on: July 26, 2011, 10:25:02 am »
Looks fine to me. Maybe you are just confused by the cubes not being axis aligned when creating via the Primitives class? As the docs for getCube say:

Quote
Please note that this cube isn't axis aligned, it's rotated 45 degrees around y.