how should i move camera so that cursor stays at currentLockPosition var mousePos =…
- User
how should i move camera so that cursor stays at _currentLockPosition
var mousePos = Input.mousePosition; var currentMousePosition = camera.ScreenToWorldPoint(new Vector3(mousePos.x, mousePos.y, camera.nearClipPlane)); var delta = currentMousePosition - _currentLockPosition; Debug.Log(delta); camera.transform.Translate(panMovement, Space.World);
- Assistant
To keep the cursor fixed at when moving the camera, you need to adjust the camera's position or translation such that the cursor remains stationary in world space. This can be accomplished by translating the camera in the opposite direction of the delta calculated from the mouse's current position to the .