オブジェクトをボタン・プレスに移動してバインドしたいと思います。ボタンを押すと、オブジェクトはすぐに消滅し、最初の翻訳が常に実行されているかのように見えます。それから、ボタンを手放すと、すぐに消えて、ボタンに触れずにどこにいたでしょう。私がボタンを押したり離したりするとき、2人の間で「バウンス」します。DirectX 11 D3DXMatrixTranslationは引き続き実行されますか?
D3DXMATRIX worldMatrix, viewMatrix, projectionMatrix;
bool result;
// Generate the view matrix based on the camera's position.
m_Camera->Render();
// Get the world, view, and projection matrices from the camera and d3d objects.
m_Camera->GetViewMatrix(viewMatrix);
m_Direct3D->GetWorldMatrix(worldMatrix);
m_Direct3D->GetProjectionMatrix(projectionMatrix);
// Move the world matrix by the rotation value so that the object will move.
if(m_Input->IsAPressed() == true) {
D3DXMatrixTranslation(&worldMatrix, 1.0f*rotation, 0.0f, 0.0f);
}
else {
D3DXMatrixTranslation(&worldMatrix, 0.1f*rotation, 0.0f, 0.0f);
}
// Put the model vertex and index buffers on the graphics pipeline to prepare them for drawing.
m_Model->Render(m_Direct3D->GetDeviceContext());
// Render the model using the light shader.
result = m_LightShader->Render(m_Direct3D->GetDeviceContext(), m_Model->GetIndexCount(), worldMatrix, viewMatrix, projectionMatrix,
m_Model->GetTexture(), m_Light->GetDirection(), m_Light->GetDiffuseColor());
if(!result)
{
return false;
}
// Present the rendered scene to the screen.
m_Direct3D->EndScene();
私はまだDX11には本当に新しく、周りをよく見ています。私はここで何が起こっているのを解決しようとしている私の髪を引っ張っています。
私はまだこのすべてにとても新しいです。 –
"各[フレーム]で非常に小さい距離だけ移動する"というかなり重要な部分は、フレーム時間を使用して距離を変更しています( 'unitsPerSecond * frameDelta')。これはあなたの動きを安定し、フレームレートから独立させます。 – ssube
本当に便利です。ありがとうございました –