MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Tagalong EnforceDistance set to false by default

Open hicotech opened this issue 9 years ago • 1 comments

Hi,

I would like to know (or understand) why EnforceDistance is set to false by hardcoding it and what is (might be) or was that mentioned "detrimental effect". I understand that Maintain Fixed Size is kind of simulating what is probably expected behavior but in my specific setup it brings more pain than good stuff.

Just quickly about my case. TL;DR; - I need Z axis of GameObject to be updated when user moves instead of scaling it.

In the project there is one Main scene with MainCamera and two other scenes (eg.: A and B) are loaded by additive mode. Scene A contains some welcome info and headset adjustment screen. Scene B contains object with Tagalong component. User can jump between these two scenes anytime. Maintain Fixed Size is working correctly on first iteration but every time when user is in scene A and moves around before switching to scene B, Size Ratio of Fixed Angular Size component is calculated wrongly (due to camera being somewhere else than before I guess) and therefore the object is resized incorrectly. It looks closer or more far than what is expected.

To sum it up. In my specific setup I want EnforceDistance to be true. Of course I changed it for me but it would be useful to know why it was set like that and if its really expected then it should have a tooltip with description what is happening.

Utilities\Scripts\Tagalong.cs

66	// The EnforceDistance functionality of the SimmpleTagalong has a
67	// detrimental effect on this Tagalong's desired behavior.
68	// Disable that behavior here.
69	EnforceDistance = false;

hicotech avatar Aug 29 '17 07:08 hicotech

Tagalong builds on SimpleTagalong (which honors EnforceDistance). Tagalong forces this to false because it attempts to respect other holograms in the scene (including spatial mapping). When EnforceDistance is true, the Tagalong could potentially end up inside another hologram behind the spatial mapping mesh. Instead it attempts to pull the tagalong in front of the other hologram, while keeping its angular size constant.

timGerken avatar Aug 29 '17 16:08 timGerken