- Edited
Hi,
I'm having difficulty adapting your FreeCamera script. Currently the camera relies on clicking the mesh of the scene to translate the camera, however, I am trying to change the script so that it simply moves the camera along it's X/Y axis by getting the delta from the screenspace for finger/pointer movement. I can easily enough move the camera to the new target position but it's unclear what needs to be done about distance and offset?
`
finalOffset = newWorldPointCameraCenterClamped;
finalDistance = CalculateClampedDistance(finalPosition, newWorldPointCameraCenter, minMaxDistance);
//finalPosition = CalculatePosition(newWorldPointCameraCenterClamped, finalRotation, finalDistance);
var scaleFactor = -0.5f;
var x = Input.GetAxis("Mouse X") * scaleFactor ;
var y = Input.GetAxis("Mouse Y") * scaleFactor ;
var move = transform.right.normalized * x + transform.up.normalized * y;
var target = transform.position + move;
finalPosition = target;
CalculateInertia();
`
Could you please advise?
Many thanks