- Home /
Question by
dobrodiejusmantas · Jul 16, 2018 at 02:04 PM ·
camera rotatecamera rotation
Camera Not Working when i build the game
When i build, game not respond to mouse movements. What i am doing wrong? Thank you for your answers!
public float turnSpeed = 5f;
public Transform player;
private Vector3 offset;
void Start()
{
offset = new Vector3(player.position.x -15f, player.position.y + 3f, player.position.z);
}
void LateUpdate()
{
if (Input.GetMouseButton(1))
{
offset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset;
transform.position = player.position + offset;
transform.LookAt(player.position);
}
else
{
transform.position = player.position + offset;
transform.LookAt(player.position);
}
}
Comment
Your answer
Follow this Question
Related Questions
Get camera rotation constrained to left/right (ie. yaw)? 2 Answers
First person camera- Limit X-axis rotation.,How to Limit Camera rotation on X-Axis 0 Answers
Camera-based movement is acting wonky 0 Answers
Camera gets stuck when cursor is locked 0 Answers
Camera to Follow rotation of Platform 0 Answers