3D Survival FPS Game

Creating a Reticule to Aim and Locking Camera Rotation

Once we have learnt how to remove the mouse arrow, it is time to replace the the empty space with a reticule. We are also going to learn how to clamp the camera rotation to prevent unwanted camera angles.

Creating the Reticule:

Since the reticule is going to be stationary at all times, we can basically create an UI image component, center the image and replace the image with your own reticule drawing. Since it is a UI component it will never move, and the camera rotation will not affect the placement of the UI component.

Once you have created a Canvas object, create an Image object within it, you can rename the image object to whatever you wish, I named mines “Reticule” for convince sake. Then I replace the image of the default white box to my personal own design. Finally I center the graphic to 0, 0, 0 to it is dead center.

Clamping the Camera to Limit Rotation angle:

Now that the Reticule is in place, you will noticed that the camera rotation for the X value can be stretched into a ridiculous 360 degrees, the last thing we want is to have our players aim at themselves, therefore we are going to clamp the camera rotation to prevent unwanted rotation angles.

In Unity we have a feature called “Mathf.Clamp” this function allows a min and max value that can be set. These values are the limitation and it can not be exceeded.

Within our Camera movement script in our looking up and down section, before we tell the camera movement we are going to clamp it.

By setting those limits our camera will now function within these parameters.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Simon Truong

Simon Truong

A Designer, an Illustrator and a massive tech geek aspiring to become a professional Unity Developer.