- Home /
camera movments fixed.. character controller without using character controller -.-'
:) hi every unitynian! please some one help me...... i'm building a level that there is a round platform, with a boss in the stay always in the center that look the player (with the method "trasform.forward"), now my question is... how can i make the camera rotate around boss that look at my player while he move around the boss?.... ps. sorry for my bad english :(
i think that maybe the easy way is to make the camera look in front of the boss (look at the image...)
Answer by Hellium · Jul 22, 2015 at 10:01 AM
I would have attached the camera to an empty point in the center of the platform. The camera would face the center of the platform (or a little above).
Then you set the rotation of this empty according to the angle between the Vector3.right vector and the (player.transform.position - centerPosition) vector.
Answer by PabloEscobarZ · Jul 22, 2015 at 11:14 AM
yeah, i solved this putting the camera as child of the boss :)... now there is an other big problem.... in the others levels, the camera doesn't rotate, beacuse in the script of the player movement, the player go forward in the direction of the arrow (as you can see here:
if (Input.GetKey (KeyCode.LeftArrow)) {
transform.forward = new Vector3 (1f, 0f, 0f);
player.transform.Translate (0, 0, step * Time.deltaTime);
}
if (Input.GetKey (KeyCode.RightArrow)){
transform.forward = new Vector3(-1f, 0f, 0f);
player.transform.Translate(0, 0, step*Time.deltaTime);
}
if (Input.GetKey (KeyCode.UpArrow)) {
transform.forward = new Vector3(0f, 0f, -1f);
player.transform.Translate (0, 0, step*Time.deltaTime);
}
if (Input.GetKey (KeyCode.DownArrow)) {
transform.forward = new Vector3(0f, 0f, 1f);
player.transform.Translate (0, 0, step*Time.deltaTime);
})
i don't use character controller.. D: that's a big issue...
Your answer
Follow this Question
Related Questions
Rotate Camera to the object 0 Answers
How to have free rotation camera? 1 Answer
Control camera rotation by induvidual axises through Vector3s (for a fixed camera system) 0 Answers
Free Orbit Cam and Mouse Aim Cam aren't working together 0 Answers
Unity - Dancing Ball World camera following and rotating system 1 Answer