Figure 9-16. The remaining objects in the newly renamed scene
3. Remove the AniTest and AniTwoState components from the objects in the scene.
4. Add the Interactor script to the Rock, the Pedestal, and the KeyAtRock.
You will have to factor in mouse-pick logic before you worry about the actual animations, so you need not rush to fill out all of the new metadata arrays just yet. You have OnMouseEnter and OnMouseExit; now you need to add the OnMouseDown for your pick events.
1. Open the Interactor script.
2. Add an OnMouseDown function beneath the OnMouseExit function.
3. Back up
4. Save the script.
As per the comments, these variables will help you refine the existing functionality as you go forward.
5. Click Play and mouse over, then click either the Rock or Pedestal objects.
If you got a response from the pick but saw no mouseover response, you will have to increase the Trigger
Distance or move the First Person Controller closer to the objects in the scene.
You have probably realized that the color changes are likely to interfere with the visual experience once the transition actions are hooked up. So, it makes sense to turn it off as soon as you have a mouse pick. You’ve already got the turn-off code in the OnMouseExit function, so you can just copy and paste it from there.
6. Add the following to the OnMouseDown function to turn off the cursor color change:
at the top, under the //Pick and Mouseover Info section, add the following variables: