Comments (4)
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.
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.
Are you using the 'orbit style' or the 'free camera' style?
from directxtk.
I'm using the free camera.
from directxtk.
Related Issues (20)
- Make use of C++/WinRT when building for C++17
- ARM64 version of xwbtool HOT 3
- `MapGuard` undefined behavior after move HOT 3
- DirectX Tool Kit for DX9
- DrawLine line thickness HOT 1
- Mesh Outline Effect HOT 2
- Point Light Shader HOT 2
- Clarify required WinSDK version HOT 2
- Hard fps lock to refresh rate value in fullscreen games - Win11 22H2 (DX11) HOT 2
- XWBtool makes all wav files the same name after repackaging HOT 5
- Audio: how to set distance attenuation/fall-off? HOT 4
- darker images loading HOT 1
- Request/question: Add a Vector4/floating point overload for the spritebatch's draw function
- undefined data type in PostProcess method HOT 3
- Aa
- Should Mouse use WM_MOUSELEAVE for Win32 raw input
- SimpleMath geometric random functions
- Error with custom shaders HOT 4
- Clang on windows fails to compile HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from directxtk.