Making objects grabbable
Our carnival midway is progressing nicely and with a teleporting function in place, the scene is becoming a fulfilling VR experience. In this next step, we will build the functions that make it possible to pick up and swing the matter for the Wacky Moles game and throw softballs in the Milk Bottle Toss game. If you have experience with the OVRGrabber
and OVRGrabble
scripts, feel free to implement the function and move on to the next section.
Follow along if this is your first time using these scripts:
- Drill down to the
TrackingSpace
of the items in theOVRPlayerController
prefab, as shown in Figure 7.18. - Right-click on the
LeftHandAnchor
and choose3D Object
|Sphere
. Rename the sphereLeftGrabber
and set its scale to (0.2
,0.2
,0.2
). - Complete this for the
RightHandAnchor
as well, naming the objectRightGrabber
. Figure 7.18 shows theLeftGrabber
andRightGrabber
as being added to children of each anchor:

Figure 7.18: Creation of the LeftGrabber and RightGrabber used to...