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.

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Using TestCase to aid in testing in Laravel

Writing an X86–64 Assembly Language Program

Volatile Markets & Liquidations: Hubble’s Guide to Managing Risk

Should I Start A Discord?

These certification Books are now on Sale!!

How to setup SSL Certificate for Click to Deploy WordPress on GCP

Is it possible to ignore the dropped packet/frame error during

How to replace Hyperkit when running Docker on a Mac with VMware Fusion

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.

More from Medium

3D Survival FPS Game

Porting VR Games to Oculus Quest

Building Your Unity 2021 Project for itch.io

My journey becoming a Unity game developer: Make a game look beautiful-Creating Columns pt.2