Hello everyone,
My current problem is that I want the camera of my game to be able to turn 360 degrees, but with my current code, as it reaches 180 degrees from both the right and left side, it slows down and stop rotating altogether.
Here is the code.
#pragma strict
function Update () {
if(Input.GetKey(KeyCode.D))
{
transform.position += transform.right *5 *Time.deltaTime;
}
if(Input.GetKey(KeyCode.A))
{
transform.position -= transform.right *5 *Time.deltaTime;
}
if(Input.GetKey(KeyCode.W))
{
transform.position += transform.forward *5 *Time.deltaTime;
}
if(Input.GetKey(KeyCode.S))
{
transform.position -= transform.forward *5 *Time.deltaTime;
}
if(Input.GetKey(KeyCode.R))
{
transform.position += transform.up *5 *Time.deltaTime;
}
if(Input.GetKey(KeyCode.F))
{
if(transform.position.y >= 1)
{
transform.position -= transform.up *5 *Time.deltaTime;
}
}
if(Input.GetKey(KeyCode.E))
{
transform.rotation.y += 2 *Time.deltaTime;
}
if(Input.GetKey(KeyCode.Q))
{
transform.rotation.y -= 2 *Time.deltaTime;
}
}
Thanks in advance