- Home /
Camera Rotating when the player reach a specific position
Hi guys. I'm a newbie in Unity3D so i will try to explain my problem in the best way. I'm doing a game like MarbleMadness.. i want that the camera follow my player and rotate when this one reach a specific position. A simple example in this video:
http://www.youtube.com/watch?v=DoX-Q38_7_M
When the ball reach the 2nd platform the camera has a rotation of 90° in X and Z axis.. so, how can i write this script? I have to make the camera following the player too! And another problem is: when the camera will have a rotation I have to change my controls too.. i mean: at the start the camera is behind the player and if i press keyUp then it starts to go ahead.. but if the camera rotate my controls have to change too in relation of the new view. I have only the script about the movement of my player.. nothing more.
 using UnityEngine;
 using System.Collections;
 
 public class PlayerMovement : MonoBehaviour {
 void Start () {
     
 }
     
 // Update is called once per frame
 void Update () {
     if (Input.GetKey (KeyCode.UpArrow)) {
         rigidbody.AddForce (Vector3.forward * 10);
     }
     if (Input.GetKey (KeyCode.DownArrow)) {
     rigidbody.AddForce (Vector3.back * 10);
     }
     if (Input.GetKey ("left")) {
     rigidbody.AddForce (Vector3.left * 10);
     }
     if (Input.GetKey ("right")) {
     rigidbody.AddForce (Vector3.right * 10);
     }
 }
 }
Thank's guys!!
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                