Answer the question
In order to leave comments, you need to log in
How to fix an error in a formula?
Hello.
I can't fix the bug with the camera in the game. For some reason, the lower the camera looks, the faster it moves. That is,
Green - where I'm looking
Blue - where I'm moving
Red - the camera
And the lower I look - the faster the camera starts to accelerate, and when I look at the floor at all - it moves away very far in one movement.
The actual code is
if (ЕСЛИ КНОПКА W ЗАЖАТА) // Вперед
{
MainRenderGraphics.pos_camera[0] -= sin(MainRenderGraphics.pos_camera_at[0] / 180 * PI) * 0.5;
MainRenderGraphics.pos_camera[1] += tan(MainRenderGraphics.pos_camera_at[1] / 180 * PI) * 0.5;
MainRenderGraphics.pos_camera[2] -= cos(MainRenderGraphics.pos_camera_at[0] / 180 * PI) * 0.5;
}
if (ЕСЛИ КНОПКА S НАЖАТА) // (назад)
{
MainRenderGraphics.pos_camera[0] += sin(MainRenderGraphics.pos_camera_at[0] / 180 * PI) * 0.5;
MainRenderGraphics.pos_camera[1] -= tan(MainRenderGraphics.pos_camera_at[1] / 180 * PI) * 0.5;
MainRenderGraphics.pos_camera[2] += cos(MainRenderGraphics.pos_camera_at[0] / 180 * PI) * 0.5;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question