Creating a drawing system
In this section, we’ll be focusing on creating a drawing system that incorporates two core components: a canvas that can be drawn on and a marker that can be used for drawing. These two objects work together to create the drawing experience. Individually, they are just objects that you can interact with. You can expand on this system by modifying the canvas to cover a larger area, allowing you to draw on a larger surface instead of the predefined size we initially create.
To create a drawing canvas (Figure 12.7), go through the following steps:
- Create a new plane.
- Name it
Whiteboard
. - Set the X position to
3.6
, the Y position to2.4
, and the Z position to-0.4
. - Set the X rotation to
90
, the Y rotation to90
, and the Z rotation to90
. - Set the X scale to
0.3
, leave the Y scale at1
, and set the Z scale to0.3
. - Create a new C# script, name it
WhiteboardController
, and add it to theWhiteboard
GO. - Add the following namespace...