~~NOTOC~~ <=[[4rpl:start| Index]] :!: Available in version 1.3 and later. ====== GetMouseDelta ====== GetMouseDelta ->mouseDelta ===== Description ===== Returns the mouse movement delta as a V2. ===== Examples ===== # Camera Mouse Fly $mouseLookSpeed:1 $moveSpeed:1 $invertPitch:0 :Frame #This function is set to get called by the MSG_FrameAdvance message. #This message comes every game frame (60 fps when in high fps mode). #This callback also happens when the game is paused. Exercise caution when using this callback since #it runs on the 'in-between' frames between game updates as well as on game update frames. @HandleMouseLook @HandleMove :HandleMouseLook GetRplCamRotation ->rot GetMouseDelta ->delta #Look right and left around the y axis (the vertical axis) <-rot.y <-delta.x <-mouseLookSpeed * + ->rot.y #Look up and down around the x axis. <-rot.x <-delta.y <-mouseLookSpeed * if (<-invertPitch) + else - endif ->rot.x SetRplCamRotation(<-rot) :HandleMove #Move forward and back in the direction the camera is facing if (GetMappedKey("MoveMapUp" false)) @Move(<-moveSpeed) else if (GetMappedKey("MoveMapDown" false)) @Move(<-moveSpeed neg) endif endif #Slide the camera right and left if (GetMappedKey("MoveMapRight" false)) @MoveLateral(<-moveSpeed) else if (GetMappedKey("MoveMapLeft" false)) @MoveLateral(<-moveSpeed neg) endif endif :Move ->speed GetRplCamForward ->fwd GetRplCamPosition ->pos <-pos <-fwd <-speed * + ->pos SetRplCamPosition(<-pos) :MoveLateral ->speed GetRplCamRight ->right GetRplCamPosition ->pos <-pos <-right <-speed * + ->pos SetRplCamPosition(<-pos) :Once RegisterForMSG("MSG_FrameAdvance" "Frame") SetRplCam(true) RPLCamCopyPosAndRot SetRplCamCursorLock(true) :Destroyed SetRplCamCursorLock(false) SetRplCam(false) ResetCamera(true) <=[[4rpl:start| Index]]