The object manipulation demo showcases how you can allow users to interact with the scene around them using a 3DoF controller. A range of different types of object interactions are included in the scene:
- Opening sliding drawers.
- Opening hinged doors.
- Lifting and placing objects of a variety of different weights.
- Physics-based interactions.
- Bendy laser pointer display.
Object manipulation can be leveraged across a broad range of VR use cases, including puzzle games, inventory based adventure games, and productivity and creation applications.
The Object Manipulation demo is included in Daydream Elements. It replaces the default Pointer with a pointer designed for complex interactions with physical objects.
Object Manipulation Pointer
The object manipulation pointer prefab overrides the base pointer to do the following:
- Track the currently held object, and ensure only one object is handled at a time.
- Visually display the ‘force' being applied to the object with a custom line renderer.
- Handle the standard pointer functionality, like drawing the controller, and reticle, and responding to ordinary pointer events.
This prefab is intended as a drop-in replacement for the
The moveable physics object class is meant to provide an example for controlling physics objects with the object manipulation pointer, or be used as-is. It requires a rigidbody, and uses forces to move objects in space, so that objects can interact with each other.
- Rotate objects around your body, based on controller position and rotation
- Move objects closer or further away, by swiping up or down on the touchpad
- Rotating an object about the world y-axis by touching the left or right side of the touchpad.
There is a folder of preconfigured objects with varying mass, titled ‘Animals'.
In order to make drawers feel correct with a 3DoF controller, drawers are manipulated based on the screen space forward vector of the drawer. If a user is exactly head-on to a drawer, an arbitrary vector is chosen. As such, the drawers exemplify a range of possible screen-space interactions.
The example drawer script only operates along the object's parent-local z-axis. In the case of an object without a parent, the drawer will operate along the world z-axis.
Hinged doors operate by using the forward vector of the controller, and the distance between that forward vector and the object being manipulated to construct a ‘pull vector'. This allows a user to open and close a door while facing the door with a 3DoF controller.
Doors rotate around parent-local y-axis, or in the case of an object without a parent, the world y-axis. To configure a door, specify the minimum and maximum yaw (rotation about y), as well as the initial yaw offset (the direction a door should face normally).
To create a new type of interactive object, either duplicate one of the existing
classes, or subclass