- Home /
Question by
athenas_appren · Jan 23, 2015 at 03:17 AM ·
camerapositioncharacter
how to position the camera? pls help.
help me pls.im new in unity and im having trouble in positioning my camera. i wanted my character to be positioned at the left side like the game banana kong. ive searched a lot about my problem but i cnt find any answers.i initially position my character at the left side of the screen but whenever i run the game the player will automatically start at the center of the camera. pls help me thank you this is for my thesis to be passed in 3 days. thank you :)
this is the code
using UnityEngine;
using System.Collections;
public class Camera : MonoBehaviour {
public Transform target;
public int zOffset;
public int minimumheight=0;
float currentY;
Vector3 position;
float orthoSize;
// Use this for initialization
void Start () {
orthoSize = camera.orthographicSize;
}
// Update is called once per frame
void Update () {
position = target.position;
position.z -= zOffset;
currentY = target.position.y;
if (currentY > minimumheight + orthoSize - 1) {
position.y = currentY - orthoSize + 1;
}
else {
position.y=minimumheight;
}
transform.position = position;
}
}
10904368-949477541730221-862233552-n.jpg
(25.5 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613181232im_/https://answers.unity.com/themes/thub/images/avi.jpg)