在我试图更新我的摄像机时,我有问题。
I want to change the pitch and yaw of the the camera (where its looking) via the mouse But I want the mouse to stay positioned to the center of the window.
//where MouseP.x .y is the mouse position
//(which is centered to the current window)
//get old position of the mouse
OldP.x = MouseP.x;
OldP.y = MouseP.y;
//work out the distance traveled
Delta.x = MouseP.x - OldP.x;
Delta.y = MouseP.y - OldP.y;
//update the camera(using distance traveled)
Rot.Yaw -=Delta.x/5;
Rot.Pitch -= Delta.y/5;
//move mouse to the center of the screen
SetCursorPos(CENTER_SCREEN_X,CENTER_SCREEN_Y);
问题在于,照相机na回某一点,因为烟.要返回原方。
我想通过从原产地出发的距离,而不是从离原地的距离,更新该照相机。
如果我看不到这一点,它会非常好,但当时的花.可以走出窗户。