- Home /
FPS control camera
Hi there I am making a fps game, my character can slide. My problem is that my camera is doing the same movement as my character which means when im sliding, my camera looks in the sky.
Is there a way to control my camera when I slide to make sure i m seeing whats in front of me.
Here is my code
void Update () { if(grounded && Input.GetMouseButtonDown(1))
{
slideInit();
}
if(!grounded && Input.GetMouseButtonUp(1))
{
slideExit();
}
} void slideInit()
{
transform.Rotate( new Vector3 (-90.0f, 0, 0) );
grounded = false;
}
void slideExit()
{
transform.Rotate( new Vector3 (90.0f, 0, 0) );
grounded = true;
}
Answer by skully42 · Feb 23, 2012 at 11:45 PM
i dont know what to tell you but to move the main camera also the problem might be that you are facing the sky so you are looking at the sky try moving your camera so you can see where you are going
Your answer
Follow this Question
Related Questions
Lerping Field Of View is buggy 1 Answer
How to get the camera to hold the gun? 1 Answer
Set Max Rotation On Weapon Sway 0 Answers
HDRP Camera weapon layer 1 Answer
Weird FPS Camera 0 Answers