Get Some Scripts
Have Unity open with the project used in the last tutorial
Download it and double click on it with Unity open.
Import all the scripts.
The scripts are documented, if you would like to view them and learn more. You can find additional resources concerning the Scripting API in Unity at the Unity Script Reference page.
Unity Scripting Languages
Boo is a lesser known language. Not many people code in Boo, but it has many similarities to Python.
The Museum Scripts
ArtifactInformation.js : This is a basic data repository script. When you add it to a GameObject, you’ll be able to enter basic information about the object in the inspector that can be shown when the user clicks on the object. Place it on each artifact you wish to interact with.
We could obtain the information in a number of ways, MySQL database, XML, etc. For this demo, we are mainly worried with what to do with the data once we receive it.
ObjectRotator.js : This script allows us to rotate the object when we click on it. It also needs to be attached to each object you want to interact with.
ArtifactViewer.js : This script is attached to the FPC’s main camera. This script will detect if we are looking at an object when we left mouse click. If an object is in front, it will deactivate the FPC, show the information of the object and activate object rotate mode. It must go on the Main Camera inside the First Person Controller.
Setup a Sphere Collider
Add a Sphere Collider
1. With the object selected, go to Components > Physics > Sphere Collider
Add New “Artifact” Tag
2. Open the Tag hierarchy and in Element 3, add the text “Artifact”.
3. Go back to the object’s properties in the Inspector, and make sure the newly created “Artifact” tag appears in the Tag drop down menu.
4. Do this for all artifacts you wish to interact with.
5. Select the FPC and assign the “Player” tag to it. The “Player” tag should already exist in Unity
2.Drag the scripts “ArtifactInformation” and “ObjectRotater” to each object you wish the user to interact with.
3.The “ArtifactViewer” script has to go in a special place on the FPC. Expand the FPC in the Hierarchy panel and locate the “Main Camera” inside of it.
4.Drag the ArtifactViewer on to the “Main Camera.”
Add info about the artifacts
Finished Museum Demo
This project was designed as a launching platform for more ambitious projects.