# Camera SmoothFollow place mesh not in the center

Hi,

I am using SmoothFollow camera. Right now I modified it so that the person is not in the center but at the center-bottom. I want to make a person appear in the bottom-left. Please, could you tell me how to modify SmoothFollow more.

``````![// The target we are following
var target : Transform;
// The distance in the x-z plane to the target
var distance = 10.0;
// the height we want the camera to be above the target
var height = 5.0;
// How much we
var heightDamping = 2.0;
var rotationDamping = 3.0;

// Place the script in the Camera-Control group in the component menu

function LateUpdate () {
// Early out if we don't have a target
if (!target)
return;

// Calculate the current rotation angles
var wantedRotationAngle = target.eulerAngles.y;
var wantedHeight = target.position.y + height;

var currentRotationAngle = transform.eulerAngles.y;
var currentHeight = transform.position.y;
var screenPosition = new Vector3(0,10,0);
// Damp the rotation around the y-axis
currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);

// Damp the height
currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime);

// Convert the angle into a rotation
var currentRotation = Quaternion.Euler (0, currentRotationAngle, 0);

// Set the position of the camera on the x-z plane to:
// distance meters behind the target
transform.position = target.position;
transform.position -= currentRotation * Vector3.forward * distance;

// Set the height of the camera
transform.position.y = currentHeight;

// Always look at the target
var cameraTarget= target.position + screenPosition;
transform.LookAt (cameraTarget);
}][1]
``````

Thank you. I attach a picture.

If you really want to do it in code, an offset can be used and added to the target position. Here is a quick rewrite of the standard SmoothFollow.js script with that change. Set the value of ‘offset’ in the Inspector. Positive value for x and y will move the object to the lower left.

``````// The target we are following
var target : Transform;
// The distance in the x-z plane to the target
var distance = 10.0;
// the height we want the camera to be above the target
var height = 5.0;
// How much we
var heightDamping = 2.0;
var rotationDamping = 3.0;

var offset : Vector3 = Vector3.zero;

// Place the script in the Camera-Control group in the component menu

function LateUpdate () {
// Early out if we don't have a target
if (!target)
return;

// Calculate the current rotation angles
var wantedRotationAngle = target.eulerAngles.y;
var pos = target.position + Quaternion.AngleAxis(wantedRotationAngle, Vector3.up) * offset;
var wantedHeight = height + pos.y;

var currentRotationAngle = transform.eulerAngles.y;
var currentHeight = transform.position.y;

// Damp the rotation around the y-axis
currentRotationAngle = Mathf.LerpAngle (currentRotationAngle, wantedRotationAngle, rotationDamping * Time.deltaTime);

// Damp the height
currentHeight = Mathf.Lerp (currentHeight, wantedHeight, heightDamping * Time.deltaTime);

// Convert the angle into a rotation
var currentRotation = Quaternion.Euler (0, currentRotationAngle, 0);

// Set the position of the camera on the x-z plane to:
// distance meters behind the target
transform.position = pos;
transform.position -= currentRotation * Vector3.forward * distance;

// Set the height of the camera
transform.position.y = currentHeight;

// Always look at the target
transform.LookAt (pos);
}
``````