Hey guys, been researching how to do this for a while but couldn’t find any clear answers.
Basically I’ve made it so the camera is fixed behind the player, so the player’s avatar is able to move around the camera space and the camera will not be centered on the player. The only problem is the player is able to leave the camera’s view. I’d like to make it so when the player tries to leave the screen the camera adjusts letting the player see a bit more but I’d also like to limit this so the player would not be able to move too far in a direction. I’m messing around with if statements and the coordinates of the player and camera atm but any help would be greatly appreciated!
Thanks 
1 Answer
1
Well what you can do is use Itween to move the camera and use a box collider to detect when the player is in this zone
what u can do is create a box object with a collider , remove the renderer and trigger the collision
Here a code for you in c# ( put it on the box collider ) :
public GameObject Camera;
void Start () {
Camera = GameObject.Find("Main Camera");
}
void OnTriggerEnter(Collider other) {
if(other.CompareTag("Player")) {
iTween.RotateTo(Camera, new Vector3( 10, 200, 0), 3);
iTween.MoveTo(Camera, new Vector3( 10, 200, 0), 3);
}
}
void OnTriggerExit(Collider other) {
if(other.CompareTag("Player")) {
iTween.RotateTo(Camera, new Vector3( 0, 0, 0), 3);
iTween.MoveTo(Camera, new Vector3( 0, 0, 0), 3);
}
Have you tried using the camera as a child of the avatar?
– adrenakWell that was my original problem, I didn't want the camera following the player all the time just when it leaves the camera's view... So any ideas??
– kidshenlong