Git Product home page Git Product logo

Comments (4)

walbourn avatar walbourn commented on June 11, 2024

Standard modern math notation uses row-major matrices, column vectors, post-multiplication, and right-handed coordinates.

OpenGL uses column-major matrices, column vectors, post-multiplication, and right-handed viewing coordinates, where -Z is 'forward'.

DirectXMath (the underlying library used by SimpleMath) uses row-major matrices, row vectors, pre-multiplication, and left-handed viewing coordinates consistent with classic "DirectX" math setup. In this case +Z is 'forward' into the screen.

Note the DirectXMath library provides both LH and RH versions of handed matrix functions so it can actually support either style.

SimpleMath uses row-major matrices, row vectors, pre-multiplication, and right-handed viewing coordinates consistent with XNA Game Studio.

And just to be fun, the HLSL compiler default is to use column-major layout, but you can opt into row-major.

You may find this blog post helpful to read.

With that out of the way, the keyboard & mouse tutorial lesson uses a "WASD" style control scheme for the XY plane, and Spacebar/X for the Z movement. Traditionally "E" and "Q" in the WASD scheme are used for rotation or look left/right, so don't really follow how you implemented your controls.

from directxtk.

jkinz3 avatar jkinz3 commented on June 11, 2024

I understand the difference between row major and column major (although pre and post multiplication was a new one).
And I know the actual bindings are that of taste. Probably didn't need to comment on them. My bad lol.
My point was simply that there are basically two methods being used to generate the local forward vector. One uses a quaternion to transform users forward input, the other uses raw trig. Both yield different and opposing results as the pitch changes.
The result is that when the camera points down almost at all and presses forward, they move backwards because the math says their forward vector is the opposite of the vector used for the lookAt vector.
Are you saying this is expected behavior? If so, then disregard. But imho, anyone coming into this tutorial series would get very confused as to why they're moving the opposite direction of the key they're pressing.

from directxtk.

walbourn avatar walbourn commented on June 11, 2024

Are you using the 'orbit style' or the 'free camera' style?

from directxtk.

jkinz3 avatar jkinz3 commented on June 11, 2024

I'm using the free camera.

from directxtk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.