- Home /
What is the required code for switching from FPs view to TPs view while having TPs view smooth?
If it's code ,wich i highly think is.Or operation. To have your player able to switch from First Person View to Third Person View and having Third person operate smoothly.Because i noticed that the default unity Third person controller is not at all as smooth as grand theft auto.
Thank you for your time.
Comment
Answer by LANDO · Jul 13, 2012 at 06:12 AM
Add this script to an empty GameObject and assign the cameras in the editor.
var cam01 : GameObject; // first person
var cam02 : GameObject; // third person
//start with first person active
function Start() {
cam01.gameObject.active = true;
cam02.gameObject.active = false;
}
//check for the return keyDown
function Update() {
if (Input.GetKeyDown ("return")) {
cam01.gameObject.active = false;
cam02.gameObject.active = true;
}
}
If you want to toggle between cameras using the same key you'll need to use an if statement and a boolean to check which camera is active.
Thank you.But i must know.How do i add this to my character? I meant like.TO switch view.Pressing "Numpad Enter" to toggle from first person to third person .Is this is bro?