DirectX 汽车与世界一起移动
DirectX Car and world moving together
我正在尝试使用 directX11 为我的汽车模型创建简单的运动,我这样做是这样的:
if (GetAsyncKeyState(VK_DOWN))
eyex += 0.05f;
if (GetAsyncKeyState(VK_UP))
eyex -= 0.05f;
if (GetAsyncKeyState(VK_LEFT))
//eyenew += (eyey + 0.05f);
eyey += 0.05f;
if (GetAsyncKeyState(VK_RIGHT))
eyey -= 0.05f;
if (GetAsyncKeyState(VK_ADD))
eyez += 0.05f;
if (GetAsyncKeyState(VK_DIVIDE))
eyez -= 0.05f;
XMFLOAT4 nEw = XMFLOAT4(eyex, eyey, eyez, 0.0f);
Car->SetTranslation(nEw.x, nEw.y, nEw.z);
Car->UpdateWorld();
XMFLOAT4 Eye = XMFLOAT4(eye1, eye2, eye3, 0.0f);
XMFLOAT4 At = XMFLOAT4(0.0f, 0.0f, 0.0f, 0.0f);
XMFLOAT4 Up = XMFLOAT4(0.0f, 1.0f, 0.0f, 0.0f);
mCam->SetEye(Eye);
mCam->CalculateViewProjection();
汽车按照我的意图移动,但接地层也是如此。我不明白,因为我在翻译中没有引用地平面。问题可能是什么?
我解决了这个问题,我忘了在平面上制作一个新的世界矩阵。
相关文章:
- 将对象移动到std::shared_ptr
- 何时在引用或唯一指针上使用移动语义
- 如何将enable-if与模板参数和参数包一起使用
- 如何将PERF_AMPLE_READ与mmap一起使用
- 如何将两个不同矢量的同一位置的两个元素组合在一起
- 如何从具有移动语义的类对象中生成共享指针
- 将shared_ptr移动到<StructA>shared_ptr<变体<结构A、结构 B>>
- C / C++ 移位/偏移/向左或向右移动位图?
- 如何将C++中的库和头与MinGW一起使用
- MSVC将仅移动结构参数解释为指针
- 将--whole archive链接器选项与CMake和具有其他库依赖项的库一起使用
- 为什么我不能将 rand() 与数组的大小一起使用?
- 将 OpenGL 实例化图形与移动对象一起使用
- 为什么复制构造函数与移动构造函数一起调用?
- QT防止QDialog/窗口与MainWindow一起移动
- 如何将相互依赖的对象移动到一起并维护内部引用
- DirectX 汽车与世界一起移动
- 无法将可移动对象与Boost.Asio一起使用
- 阻止子窗口与其父窗口一起移动
- 移动lblas库并将其与g++编译器一起使用