3

I am a bit of a novice with the Unity Engine and Mixed Reality App development so please bear with me.

I have been working with the Microsoft Mixed Reality Toolkit for Unity to try and animate a game object and move it to the side. A simple action, very similar to an example scene provided by Microsoft with the toolkit called "InteractableObject" (Information links provided below)

Interactable Object - Mixed Reality (Microsoft Docs)

Mixed Reality Toolkit-Unity Interactable Objects and Receivers (Github)

This example scene in Unity has multiple objects to be used as "buttons". With the Mixed Reality Toolkit, even objects that you want the user to interact with to perform some sort of action when selected is even considered a button. At least according to the documentation I have actually been able to find on the subject. This is a series of screenshots depicting the inspector panels for my GameObject and the container for my object:

GameObject Inspector Panel

GameObject Inspector Panel

GameObject Container Inspector Panel (Part 1

GameObject Container Inspector Panel (Part 1)

GameObject Container Inspector Panel (Part 2

GameObject Container Inspector Panel (Part 2)

I am trying to make a single game object move to the side when I place the standard cursor on it. This same action is done with a balloon object in the example scene I mentioned. I have created the animator and the state machine the same as they did in there example as well as setup my game object in an almost identical format. Only real difference is that created a balloon object themselves and I am using a different set of custom models from my company.

When I attempt to play back the app in the Unity Editor, the state does not change when I place the cursor on the object. I can force the state to change using the editor and the required animation engages, but it will not change the state on its own. I configured my state machine the same as the Microsoft example and setup my state variable the same as well. It should move from an "Observation" state to a "Targeted" or "ObservationTargeted" state when the cursor moves onto the object. A screenshot of the GameObject state machine and the inspector panel of the specific transition in question are provided below:

GameObject Animator State Machine Setup

GameObject Animator State Machine Setup

Observation to ObservationTargeted Transition Inspector Panel

Observation to ObservationTargeted Transition Inspector Panel

I went through and verified that all components added by the Mixed Reality Toolkit are the same and they are. This includes the DefaultCursor, InputManager, MixedRealityCameraParent and Directional Light. I also checked that all the scripts were coded the same as well and they are. I am running out of places to look. I attached the Visual Studio debugger to the project in Unity and have verified that it just isn't changing the state on its own. But I cannot figure out why. I believe the problem has something to do with the setup of the transition, but I haven't been able to find the issue. All of the other mentioned components are provided by Microsoft and are not changed by myself nor are they changed in the sample scene.

If anyone else has had a similar problem or may know where I can look to find the problem please let me know. I haven't even built the project into an UWP application yet.

derHugo
  • 83,094
  • 9
  • 75
  • 115
BluiWulf
  • 31
  • 4
  • Could you add some Screenshots of your setup? It is hard to understand what components you are talking about and how your state machine looks like – derHugo Nov 28 '18 at 21:20
  • Given the nature of the project, I cannot post any screenshots of the project. It contains information that cannot be shared. I am mostly wondering if anyone else has messed with the mixed reality toolkit for unity for working with the HoloLens or other mixed reality headsets and have successfully created animations using this toolkit and the standard gaze capabilities. Supposedly, the Mixed Reality Camera has the capability to change the gaze to an object and create an action based on that action without adding additional coding. – BluiWulf Nov 29 '18 at 03:40
  • If it is about a custom cursor you allways can simply copy it into a new empty project and make screenshots without the "secret" information. Some here have done it ;) that's why it would be necessary to see your actual setup in order to help you find what's wrong. It is e.g. also possible that it just isn't working yet because you didn't switch to the UWP platform yet in the build settings? – derHugo Nov 29 '18 at 07:54
  • 1
    I was able to make some screenshots without compromising anything that I shouldn't. I will point out it is not a build problem because I have switched it to the UWP platform and I haven't even reached a build point. All of this is from testing directly within the Unity Editor and attaching the Visual Studio debugger to the Unity Editor. – BluiWulf Nov 30 '18 at 02:15
  • I'm not completely but pretty sure that anything supposed to be a button in the MixedRealityToolkit has to be on the layer UI. You can try and set your interactable object to the UI layer. Does the Cursor pass through the object or is it set on the front of the collider? If it passes than the MixedRealityToolkit isn't recognizing it as interactable and setting it to UI should solve it – derHugo Nov 30 '18 at 06:10
  • I verified the layers used in the sample scene and my own and they match up. Just in case, I tried moving the objects to the UI layer and it had no effect. It appears as the if the cursor is hitting the collider, but I am not honestly sure how to verify this. The only thing I can think of right now is that the transition isn't setup correctly. – BluiWulf Dec 03 '18 at 20:29

1 Answers1

0

I know it's been a few months, but do you still looking for the solution?

With the newest version of Mixed Reality Toolkit you could make any GameObject to act as a button. Simply read this documentation. I have some cubes as buttons in my Unity project and the only extra Component I added to it to make it work was Interactable, which comes from Mixed Reality Toolkit.

If you want to trigger some animation when you place the cursor on the object (or look at it if you're going to use it with Hololens) then you can add them in Interactable object by adding a new Event (for example: OnFocus() event)

Hope this helps is any way

Irek
  • 187
  • 2
  • 12