Creating a laser aim with Projector and Line Renderer
Although using GUI elements, such as a cross-hair, is a valid way to allow players to aim, replacing (or combining) it with a projected laser dot might be a more interesting approach. In this recipe, we will use the Projector and Line components to implement this concept.
Getting ready
To help us with this recipe, it's been provided with a Unity package containing a sample scene featuring a character holding a laser pointer, and also a texture map named LineTexture
. All files are inside the 1362_06_03
folder. Also, we'll make use of the Effects assets package provided by Unity (which you should have installed when installing Unity).
How to do it...
To create a laser dot aim with a Projector, follow these steps:
Import
BasicScene.unitypackage
to a new project. Then, open the scene named BasicScene. This is a basic scene, featuring a player character whose aim is controlled via mouse.Import the Effects package by navigating to the Assets | Import...