In this section we'll add a grabber tool to pick up objects in the environment. Depending on the tool, setup is a three or four step process:
Note: This section continues with the configuration and script used in the previous section.
Now add a mouse buttons input to use with the grabber. From the Inputs tab, click Add a New Input, select the Mouse Buttons option, and click Apply & Exit.
From the Tools tab, click Add a New Tool, and select the Grabber option. The using physics parameter should only be checked if physics is enabled in the script that uses the grabber. Our script will not use physics so uncheck the box and click Apply & Exit. The grabber is automatically applied to the avatar's r_hand slot:
Open the Mappings dialog box to view or change how input signals are mapped to a tool's actions. Map the left mouse button to the grabAndHold action:
The last thing we need to do before we can use the tool is to define some objects that it can manipulate. This part is done through the script that imports the configuration. Create a new Vizard script and add the code below to set the scene. Save the script in your avatars and tools tutorial folder with the vizconnect_config.py file.
Next, get a handle to the grabber tool and pass it a list of the objects that it grab:
Run the script and move the hand over to one of the shapes. When the grabber tool intersects an object in its items list it will highlight the object. Hold the left mouse button to grab and move an object.