PDF – Creating a Moving Text Path in VR

Create a Text Path with Bezier Spline in Unity  

14 steps to prepare necessary files and create a moving string of 3D text in Unity

Scripts required: Bezier Spline, Spline walker array

Scripts link: https://catlikecoding.com/unity/tutorials/curves-and-splines/

VIMEO link: https://vimeo.com/726391996

Step by step (preparation):

  1. Start by downloading the project files from Catlike Coding with this link, extract them, and put them in respective folders.
  2. Ensure you have the Oculus Integration package (full instructions here).
  3. Use the search bar in Unity to find the OVR Player Controller and drag it to the project hierarchy menu (skip steps 2 & 3 if it’s already in your menu). 
  4. Set up your scene as desired, remember to include a camera if using for VR.
  5. To prevent the camera from falling out of the scene, create a 3D plane and uncheck the mesh renderer option in the plane inspector. Size and position the plane as desired. 

Step by step (create the path):

  1. Create two empty game objects and a 3D text object (fig. 1); Rename them with descriptive titles and select reset in all of their transform menus (fig. 2).
  2. In the text object’s transform menu, reduce the scale to 0.1 or 0.01. 
  3. Select the empty game object you wish to use for the path. Click Add Component in the object inspector, select the Bezier Spline script (fig. 3).
  4. Press F to create the line. Adjust the line by dragging the points. Add more points to the line by clicking add curve in the Bezier Spline menu (fig. 4).
  5.  Next, select the empty game object reserved for the Spline walker array and select the appropriate script in the object inspector. 
  6.  Click and drag the path game object from the hierarchy menu to the Spline field in the Spline walker array script menu (fig. 5). 
  7.  Also in the Spline walker array script menu, enter a numerical value for the movement duration (this can be adjusted later) and change the mode to loop. 
  8.  Click and drag the 3D text object from the hierarchy menu to the selector field in the Spline walker array script menu. 
  9.  Click the play button at the top of the window to see the animation. Adjust the text appearance under text mesh in the 3D text object inspector as desired. 
Graphical user interface, application, table

Description automatically generated

Fig. 1
Creating 3D text object

Graphical user interface, text, application

Description automatically generated

Fig. 2
Resetting game objects and 3D text object

Graphical user interface, application

Description automatically generated

Fig. 3
Adding Bezier Spline script to the empty game object

Graphical user interface, text, application

Description automatically generated

Fig. 4
Adding more points to the line

 

Graphical user interface, text, application

Description automatically generated

Fig. 5
Dragging the path object to the Spline field

Note:

  • If text is appearing lo-res, try increasing the font size in the 3D text object’s text mesh menu and decreasing character size or the scale in the transform menu. 
  • The moving text being displayed can be edited by opening the Spline walker array script and editing the string sentence comment. See video instructions