Let’s get Pacman Hologram Bounding in a Box

Ivana Tilca

Let’s get Pacman Hologram Bounding in a Box


October 11, 2023

Before starting with our tutorial, please make sure you follow installation instructions from this post (check requirements).

Once you have your project ready, you will see something like this:

Let’s get Pacman Bounding in a Box

What is a Bounding Box and when is it needed?

Basically, if you want to transform objects in Mixed Reality, this is the standard interface (BoundingBox.cs) that Microsoft provides. It allows you to scale, rotate and display proximity.

How can I Transform an object?

* We will use a PacMan I created, you can download the object in this link.

1 – Go to Asset> Import new Asset> Pacman> Import. We will use this object to start learning how the bounding box works.


2 – You will see the object in your Asset folder under Project. Drag and drop it to your scene.

3 – Select the Pacman object in your scene, then go to Inspector and change the values to the following:

4 – Let’s add some color to it. Go to Asset > Create> Material. Name the material Yellow. Select the material in your Asset folder then go to Albedo property in the Inspector panel and set it to #FFF400. Finally drag and drop the material on top of your Pacman object located in your scene.

5- With the Pacman Object selected, go to your Inspector Panel > Add Component > Box Collider. Repeat this step and Add Component Bounding Box. Ok, let’s check the properties that we have:

  • Target Object. This specifies the object that you want to manipulate. If it’s empty then it will work with the default owner object.
  • Bounds Override. Sets a box collider from the object for bounds computation.
  • Activation Behavior.
  • Activation on start. If you want the bounding box to become visible once the scene is started.
  • Activate By Proximity. If you want the box to become visible when the articulated hand is close to the object.
  • Activate By Pointer. It activates if it is targeted by a hand-ray pointer.
  • Activate Manually. You have to activate it through script by setting the BoundingBox.Active to true.
  • Scale minimum. Minimum allowed scale.
  • Scale maximum. Maximum allowed scale.
  • Box Display. These are visualization options.
  • Flatten axis > Flatten Auto – the script will disallow manipulation along the axis, which results in a 3D bounding box.
  • Handles. You can assign a material and prefab to override the handle style.
  • Events.
  • Rotate Started. Fired when rotation starts
  • Rotate Ended. Fired when rotation ends
  • Scale Started. Fires when scaling ends.
  • Scale ended. Fires when scaling ends.
  • Handles Styles
  • Default Hololens 1 style.
  • If you want to apply the Hololens 2 style then click on the little dot located to the right of the Inspector Panel > Handle > Handle Material and search for two of the default materials like this:
  • Finally, set the following properties:
  • Proximity. Shows or hides the animation based on the distance to the hands.
  • Proximity Effect Active. Enable
  • Handle Medium Proximity. Distance first step scaling
  • Handle Close Proximity. Distance second step scaling

6 – Ok, we have set properties for the box, but we cannot move it yet. So, how do we manipulate it? We have to combine it with a Manipulation Handler (manipulationhandler.cs). This handler supports single-hand and two-hands manipulation. So, select Pacman in your scene and go to the Inspector panel > Add Component > Manipulation Handler. Let’s understand the properties we have here:

  • Host Transform. Transform that will be dragged; if it is empty, it will transform the object (this property is assigned to Pacman in our example).
  • Manipulation Type. Specifies if the object can be manipulated with one, two, or one and two hands.
  • Two handed manipulation Type. This will indicate how the object can be transformed
  • Allow far manipulation. If you want to allow manipulation with pointers.
  • One hand rotation mode near. How the object will behave if manipulated with one hand.
  • One hand rotation mode far. How objects will behave if manipulated by control at a distance.
  • One hand rotation mode options. How the object will rotate if grabbed with one hand
  • Maintain original rotation. Does not rotate objects when moved.
  • Maintain rotation to user. Maintains rotation x/y to the user perspective.
  • Gravity aligned maintain rotation to user. Maintains object’s original rotation to the user but makes the object vertical.
  • Face user. Ensures the object always faces the user.
  • Face away from user.  Faces away from the user, useful for panels, slates.
  • Rotate about object center. Only works for articulated hands/controller.
  • Rotate about grab point. Only works for articulated hands/controller.
  • Release behavior. When an object is released, specify a physical movement behavior. Requires a rigid body component.
  • Constraints on rotation. Specifies which axis the object will maintain when rotated.
  • Use local space for constraint.  Constraints to world space axis or local space axis.
  • Constraints on movement.
  • Smoothing active. Smoother animation.
  • Smoothing amount one hand.

Great! Now we have our project ready!

Ivana Tilca

To learn more contact us

Continue reading

Ready to connect?