vk_up и vk_dow начинает искажать < /li>
< /ul>
Это заставляет меня сделать вывод, что что -то не так с тем, как делается вращение, но я не смог найти решение. неправильно]). Вот код для вращения всех направлений: < /p>
Код: Выделить всё
//rotation to right
else if (wParam == VK_RIGHT) {
//rotate camera dir
double oldDirX = dirX;
dirX = dirX * cos(-HrotSpeed) - (dirY * sin(-HrotSpeed));
dirY = oldDirX * sin(-HrotSpeed) + (dirY * cos(-HrotSpeed));
//rotate camera plane
double oldPlaneX = planeX;
planeX = planeX * cos(-HrotSpeed) - (planeY * sin(-HrotSpeed));
planeY = oldPlaneX * sin(-HrotSpeed) + (planeY * cos(-HrotSpeed));
}
//rotation to left
else if (wParam == VK_LEFT) {
//rotate camera dir
double oldDirX = dirX;
dirX = dirX * cos(HrotSpeed) - (dirY * sin(HrotSpeed));
dirY = oldDirX * sin(HrotSpeed) + (dirY * cos(HrotSpeed));
//rotate camera plane
double oldPlaneX = planeX;
planeX = planeX * cos(HrotSpeed) - (planeY * sin(HrotSpeed));
planeY = oldPlaneX * sin(HrotSpeed) + (planeY * cos(HrotSpeed));
}
else if (wParam == VK_DOWN) {
if (currPitch - VrotSpeed >= MIN_PITCH) {
double oldDirY = dirY;
// rotate camera dir
dirY = dirY * cos(-VrotSpeed) - dirZ * sin(-VrotSpeed);
dirZ = oldDirY * sin(-VrotSpeed) + dirZ * cos(-VrotSpeed);
double oldPlaneY = planeY;
// rotate plane dir
planeY = planeY * cos(-VrotSpeed) - planeZ * sin(-VrotSpeed);
planeZ = oldPlaneY * sin(-VrotSpeed) + planeZ * cos(-VrotSpeed);
currPitch -= VrotSpeed;
}
}
else if (wParam == VK_UP) {
if (currPitch + VrotSpeed
Подробнее здесь: [url]https://stackoverflow.com/questions/79545192/3d-rendering-issues-involving-raycast[/url]
Мобильная версия