Coordinates System

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
TestDev
Posts: 11
Joined: Tue Jun 19, 2018 3:15 pm

Coordinates System

Post by TestDev »

Hello All,

I know this must have been asked before but I have been struggling to find a 100% solid answer. So before we get into it my 3d positions have been a little off and this could be down to a number of reasons (Coordinates, Camera positions, 3d editor exporting, programming oops). So first and foremost I just want to make sure that my understanding of the underlying coordinates system is correct as I feel I have gone down a rabbit hole with this one.

So first of all regardless of the handedness of the system:
Increasing X will move the object to the right of the screen, and decreasing will move to the left.
Increasing Y will move the object towards the top of the screen and decreasing will move to the bottom.

For a left handed system:
Increasing the Z will move the object "into" the the screen and decreasing will move towards the user.
All rotations are clockwise around their axis.

For right handed systems:
Increasing the Z will move the object "out" the the screen and decreasing will move away from the user.
All rotations are counter-clockwise around their axis.

Then Irrlicht uses a left handed system?

If I have made any mistakes above I would appropriate it if you could let me know as it will help me with my debugging.
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Coordinates System

Post by devsh »

Don't think about X right Y up, it really depends on camera orientation and rotation.

Irrlicht does use a left-handed coord system (unfortunately), what this means exactly is that:
X) Thumb of your left hand
Y) Index finger of your left hand
Z) Middle finger of your left hand

Whichever way you rotate and turn it, the relationship remains the same.


As for rotations, they are completely beyond repair... the order they get applied really matters (XY or Z first, etc.) and is really not consistent between different 3D engines and tools.
So use quaternions!
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Coordinates System

Post by CuteAlien »

devsh is correct, aside from quaterions which are debatable and which you certainly don't have to learn just to get started in 3D! (@devsh: please stop scaring newbies...)

That said - if your camera up vector is pointing up the y direction (0,1,0) and your view-target is along the z-axis with higher z-values (relative to your camera position) being in front of you (like camera is at (0,0,0) and target at (0,0,1)) - then you are correct. It's a somewhat special case, but often used in 2D games as it allows to have the typical X,Y coordinates as used in many tools.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Coordinates System

Post by devsh »

I dont see why quaternions are debatable, yes they are slower, but they are mathematically consistent and there is no ambiguity in their definitions.

Irrlichts rotation functions differ from wikipedia or wolfram math in order and naming. Also somehow associating the 3D axes to pitch,yaw,roll.
Thats what causes gnashing of teeth when you finally finish all the irrlicht tutorials.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Coordinates System

Post by CuteAlien »

Most people don't know much about quaternions while everyone learns eulers in school. And if you need quaternions for something then they are there. Just not in the SceneGraph. Uhm, actually not sure about rotation order - not something I've run into so far. That part should probably be documented, even if it hasn't caused problems to me so far.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
TestDev
Posts: 11
Joined: Tue Jun 19, 2018 3:15 pm

Re: Coordinates System

Post by TestDev »

Hello Both,

Thanks for your input, I have managed to succeed in debugging my issue. Once I understood the coordinates I found the following:
1) I think my normal were incorrect leading to the back of the model being shown
2) My texture was rotated by 90 degrees which contributed to my loss of orientation.
3) My model had the incorrect handedness

I would say that if anyone else has issues maybe try checking the above.

Not that I have solved the above everything is mapping out correctly and now programmaticly reaching and placing the coordinates is no easy and logical. Hopefully this foundation will not let me build much bigger and higher.
Post Reply