- Home /
Need help inserting First view controller and 3d
Okay Guys i have been working on an rpg.. which i want this to be advanced.. But i thought of something of how the game could have setting for either to view in first person or can choose 3d person view.. but i dont know how i could get that.. Any help would help me alot thanks!!
Answer by Neten · Nov 16, 2011 at 03:14 AM
Take and combine the necessary codes from the first person and third person camera scripts which are found among the Standard Asset package called "Character Controllers".
Set a boolean variable. Lets say:
var isFirstPerson:boolean=true;
Then, what you want to do is to set conditionals for the lines of code you got from the first person and third person camera scripts. An example would be:
function Update()
{
if(isFirstPerson)
{
//put the first person camera script here
}
else
{
//put the third person camera script here
}
}
Then you can put up some other conditionals to change the boolean value we created. An example would be:
inside the scope of function Update()
if(Input.GetKeyDown(KeyCode.C))
{
isFirstPerson=!isFirstPerson //this "reverses" the value
}
Hope I've been informative, have a nice day and good luck on your project.
Answer by xmagz · Nov 17, 2011 at 03:04 AM
Thank you very much!!
Hey, please accept my answer so this question will be seen as answered. Thanks.
Your answer
Follow this Question
Related Questions
How To Make A Simple MMO? 3 Answers
A node in a childnode? 1 Answer
Export from unity to UDK 2 Answers
combat grid not working 2 Answers
Pathfinding for RPG games 2 Answers