microsoft / MixedReality-WorldLockingTools-Unity

Unity tools to provide a stable coordinate system anchored to the physical world.
https://microsoft.github.io/MixedReality-WorldLockingTools-Unity/README.html
MIT License
188 stars 45 forks source link

Extending / overriding alignment manager #191

Open camnewnham opened 3 years ago

camnewnham commented 3 years ago

Goal

I'd like to experiment with different techniques for triangulation and weight computation of space pins.

Challenge

From looking through the code, it seems like the types are hardcoded all the way from WorldLockingContext -> WorldLockingManager -> AlignmentManager -> ComputePoseWeights().

Locally, the easiest way for me to do this is to directly edit the AlignmentManager, but changing the source code in this way puts me in some debt when I next update WLT as I need to reconcile my local changes against the source, and I can't easily do that until I've imported the package. Ideally, I'd like to also stay up-to-date with this repository, so I have been thinking about ways of refactoring some of this in a general way (that could be a PR) to be able to swap out the alignment manager without breaking or overly complicating anything else. Initially I had thought that using WorldLockingManager<T> where T : IAlignmentManager would suffice but this is made a bit trickier by the static GetInstance method. Any suggestions?

Alternative

I've found in the past that a good way of maintaining a reference to the source code (via git) but allowing local customization in Unity is to use git packages - meaning that it's easy to maintain a fork in an active project and pull/compare changes from the master branch, subsequently also encouraging user contributions. An example of a repository structured this way would be https://github.com/atteneder/glTFast. Would it be possible to structure the repository this way, or alternatively create a separate repository that gets this structure created via a pipeline?