看看你是否能够修改摄像机类,使得其能够变成一个真正的FPS摄像机(也就是说不能够随意飞行);你只能够呆在xz平面上
1 // This function is found in the camera class. What we basically do is keep the y position value at 0.0f to force our 2 // user to stick to the ground. 3 4 ... 5 // processes input received from any keyboard-like input system. Accepts input parameter in the form of camera defined ENUM (to abstract it from windowing systems) 6 void ProcessKeyboard(Camera_Movement direction, float deltaTime) 7 { 8 float velocity = MovementSpeed * deltaTime; 9 if (direction == FORWARD) 10 Position += Front * velocity; 11 if (direction == BACKWARD) 12 Position -= Front * velocity; 13 if (direction == LEFT) 14 Position -= Right * velocity; 15 if (direction == RIGHT) 16 Position += Right * velocity; 17 // make sure the user stays at the ground level 18 Position.y = 0.0f; // <-- this one-liner keeps the user at the ground level (xz plane) 19 } 20 ...
鼠标移动的时候可以改变方向向量,但是我们在键盘点击函数里面强行把y坐标设置为0,这样就不会产生y坐标上的移动了
2019/11/29
原文:https://www.cnblogs.com/ljy08163268/p/11959100.html