-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of Controller Model Visualization Task #2807
Implementation of Controller Model Visualization Task #2807
Conversation
Updated controller mapping profile inspector. Removed unused fields and properties from controller input mapping and controller vis settings
Added an update to this PR for reivew Notably, this makes the Visualization system its very own Manager and decentralises the scene management and abstracts the visualization layer |
@SimonDarksideJ Can you provide an example of how we would get the controllers with your CR on my PR? |
As it's now a manager, the call would look like any other manager call, e.g.
Obviously like any other system provided by a Manager (including the Input System) you'd want to cache the reference and in the case of the Solver handler, make it a Static reference so it's the same across all handlers.
|
Still not sure about how I feel about a viz manager, but I'd like to hear @keveleigh and @Ecnassianer's input as well. What do you guys think? |
Sorry to still be a stick in the mud, but we simply add the visualizer to the controller, still for the same reasons:
If the Visualizer is a thing that is needed in the SourceDetected event, then simply add the visualizer to the EVENT not the controller (using the interface).
QuestionIf we do move the reference to the visualizer, do we even need the "DetectedVisualizers" hashset any more? Would GameObjects being able to discover the visualizer from the Event be enough to meet @davidkline-ms requirement of discovering visualizers? |
on another point, we should probably close all of the final SolverHanlder PR's until this PR is solved (no pun intended) as the implementation will have to change to meet the output of this PR anyway |
We pretty much do the same thing with pointers (granted it's an array of them). I know the circular reference isn't ideal, but I think it solves the problem without a complex solution. My favorite circular reference in unity is: |
And yes, we'd still need the hashset to query against in the event a source is detected before our listener was subscribed. |
If we were to add the visualizer to the source detected event, the list of visualizers would need to move into the input system. (Which I think is okay, seeing as the profile and viz manager both depend on the input system) |
No need to move the list of detected Visualisers to the Input System, simply passing the reference down in the event is enough. |
You can't know the position of a controller without the input system, and without the input system the Controller's rendered model isn't going to be where it needs to be. Unless you made the visualization part of the input system or the controller itself (but we already agreed the transform position shouldn't be part of the device layer so we can port the system to other engines). We need to know the position of the rendered controller. We can't do that without the input system sending the positional data to the controller, or the controller keeping track of its own position. |
In either case, my main goal is to have this function pretty much exactly like pointers, where we set a prefab and have it get created as needed. |
We spoke about this in another thread which I can't find at the moment, but can we change the name from "Visualizer" to something else. This PR seems like the place to make that change. Here are some things that I think would more clearly reveal the purpose of these classes: SceneRepresentation (i.e, ControllerSceneRepresentation or ControllerRepresentation) Let me know if you want a recap of why I think Visualizer is a misleading name. |
How is it misleading? |
"Visualizer" seems to imply that the focus of the class is in rendering a visual representation of the controller. It's about pushing pixels to the screen. But what I understand now is the "visualizer" class is all the data that the device puts into the scene, not just the visuals. Consider approaching this problem from a naive perspective: I don't want to show mechanical controllers in my fantasy game. Instead I want to use information about the controller state (button states, location, etc) to draw some kind of particle fairies around where the controllers would be that always look at your hands, but aren't necessarily in the same place as your hands. Given that prompt, a "Controller Visualizer" isn't nearly the first thing I would look for, since I explicitly don't want to visualize controllers, I just want to get scene data about the controller. The more we build out the "Visualization System", the lower percentage of it actually has to do with visualizing controllers. We're already seeing this class grow in a non-visualization direction, we should anticipate further growth in other directions with a more generalized name. |
I think the Loop in Start(), Then Listen for OnSourceDetected and OnSourceLost pattern is necessary to support (so we can support things like having the world behave differently when a controller leaves), but I also think we should offer some kind of shorthand that manages all that boilerplate for you. Something like this: There are a lot of lighterweight situations that don't want to manager the controller themselves. They just want a transform or whatever. |
I'm cool with "proxy". |
To look at this from another pose (pun intended) @Ecnassianer Whereas, this "visualizer" provides a visual representation of A controller which receives information from the pose Synchronizer to display it on the screen. So, you have a few options as a MRTK dev:
I'm not adverse to renaming it to the Controller Proxy / Controller Proxy Manager (as it's also the terminology used by VRTK) but want to be sure we are talking about the same thing. |
@SimonDarksideJ I wasn't able to easily overload the on source detected like we wanted to do and pass the visualizer (proxy?) controller through with it. Any other ideas? At the moment it's pretty much identical to how pointers are setup and used (which was the goal, seeing as they serve virtually the same function, sans the controller proxy itself should be unique to the controller, but there could be multiple pointers). I'm not so keen on having our own Visualization System as it's completely driven by the input system, and our goal was to have systems not be depend on each other. All that manager does is just keep a list of the device visualizers and I'm not sure why the Input System can't just facilitate that. If we wanted to make it its own full blown system, we should also add event handlers when visualization is added/removed, etc |
I would rather we enable the input system to provide the controller gameobject(s) and avoid making another system that would introduce cross component dependencies. |
Except that other engines are going to have different requirements... I wouldn't worry about porting at this point. |
haha isn't that the truth! 😆 |
Okay I can't do a hard reset on this, so I'll need to open a new PR. I'll be sure to link this one. |
This statement is not really valid
This was only the start of the (controller) visualization system, who responsibility was to maintain and control the visualized elements in the scene. Moving yet another function in to the Input system is a mistake imho, as it breaks the rule of only having individual component systems responsible for a single area / function. Now in order to replace the input system (granted not something we advise people to do, they should contribute to this one), they are going to have to rewrite:
A single system should not be this big and have responsibility over so many features, which was one of the fundamental issues with the old HTK that we were trying to break free from. Really not happy with having an input system also being responsible for scene management of features (pointer visualization was a very fine line as it already generated pointers) doing both the job of routing and now UX, but that seems to be the consensus for the approach. |
😅🤔 I know you are correct. But I'm not sure how to facilitate the visual parts with being driven by input itself. Seems like the visualizer system would be too dependant on the input system, which was another requirement, as there shouldn't be dependencies on other systems. I'm trying to figure out a middle ground where we can all agree so we can move forward. |
Overview
I've broken out the visualization of the controllers into their own profile, to give more fine grained control over the controller models. Part of the reason for this change was the fact that the input mapping profile didn't allow us to expose override models and other settings because of the pop out windows.
I've added a
IMixedRealityControllerVisualizer
that supports getting the controller'sGameObejct
reference without breaking the architecture design patterns we've established. (You'll notice that I updated theBaseController
class to properly reference this interface, and not the transform or game object reference).I've enhanced the controller visualization profile's model object fields to ensure we're assigning valid prefabs only (and not just mesh assets) as well as adding the user defined concrete type that implements
IMixedRealityControllerVisualizer
.Here's a little snippet example of how to get the controller visuals from the input system:
(You'll notice that we can get any number of detected controllers)
Changes
TODO
Breaking Changes