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…)
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.
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…