# Asteroids demo axis mapping

I’m working with the asteroids demo and i noticed something very odd, the x,y coordinates are really the x,z coordinates.

I see this going on

obj.setPos(pos.getX(), depth, pos.getY())

So even though it’s using “getY” it’s loading it into the z-position, and the depth is loaded into the Y coordinate.

That tells me that the “Y” axis on the screen is really the Z-axis and the Y-axis is going into (or out of) the screen.

Now we finally get to my question. I can’t seem to figure out if that’s the default or whether the program has set it up that way. At this point i’m relatively sure that this is not being set.

1 is the cordinate system x-z the default ?
2 how do i change it so that x-y is the surface and z is the into/out-of the screen ?

Thank you

By default, Panda treats the positive y-axis as “forwards”, the positive z-axis as “upwards”, and the positive x-axis as “rightwards”, I believe.

One way might be to simply pitch the camera downwards by ninety degrees (and perhaps move it, if called for), I think.

This would, however, come with the caveat that if you were to use the “getForward” or “getUp” methods of the quaternion class you would still get the relevant y- and z- axes, respectively.

Ah! But on doing a little searching, I found that there is indeed a way to change the default coordinate system–see here. I don’t know what the consequences of doing so might be–if any–however.

[edit 2]

It’s only using “getY” there because the input is a 2D vector, and thus only has x- and y- values, I daresay.

1 Like

I don’t want to break built-in methods, so I’ll “suffer” with the default set-up. Once I’m sure everything is working, i’ll try changing the coordinate system and see what trouble it causes.

Thank you !

1 Like

By convention, Z is up. But the axes can mean whatever you want, because you can point the camera any way you want. Along the Z axis, for example. You can also just put everything under a common parent node and rotate that.

Setting coordinate-system y-up-right in Config.prc switches Panda to use the Y-up convention across the board.

2 Likes

thanks for the awesome information.