Search code examples
c#unity-game-enginehololensmrtk

Creating a Handle for Manipulation (Unity/MRTK)


Question

I develop an application for Hololens 2 in Unity (+MRTK). I want to move/manipulate Gameobjects so i used the ObjectManipulator, BoundsControl and NearInteractionGrabbable Scripts from MRTK plus a Box Collider on the parent.

The hierarchy looked something like this:

  • Container
    • Element 1
    • Element 2

With that i could grab the whole container and move everything. Now i want to be able to select the individual elements inside the container - but the BoxCollider of the parent blocks/disturbs selecting the inner colliders of the elements.

Thats why i now try to use a handle/proxy object (Cube) which applies the interactions to the whole Conainer. The hierarchy can be seen in the next image (just imagine additional elements besides the Handle): Hierarchy

Here i have inside the container (AnchoredContainer) now a handle which is a Cube gameobject (HandleObject) with the respective scripts. The scripts are linked to the AnchoredContainer so that moving the cube moves everything (including the cube itself).

Problem

The Problem is now that i seems to be a little bit buggy. I can move/resize the container but it is really hard to grab/select the Rotation Handles and Scale Handles of the BoundsControl. In the next image you can see the flickering when trying to select something on the cube. Also when i resize the cube i loose the resize action as soon as the cube gets slightly smaller.

Error

What hierarchy do I need or what can I change in the code to use a proxy for the interaction?


Solution

  • Solution

    As Zuocheng Wang - MSFT pointed out the Solution is to set Activation in BoundsControl to Activate On Start. With this setting, the flicker disappears during focusing and also during movement!