microsoft / MixedRealityDesignLabs_Unity

Mixed Reality Design Labs share experimental samples, explorations and learning from Windows Mixed Reality Design group. If you are looking for official toolkit, please use Mixed Reality Toolkit
MIT License
408 stars 110 forks source link

Bounding box #96

Closed tspaddock closed 6 years ago

tspaddock commented 6 years ago

Hi, I am looking for a reference document on how-to setup my MRDL bounding box to scale by only x or y axis. Not only Uniform. Anyone know of a site that they can point me towards? Thanks!!

Zulex commented 6 years ago

It worked at my setup by changing the script manually, it doesn't get variable from the inspector very well. Somewhere in the script it's noted which axes should be adjusted.

tspaddock commented 6 years ago

Thanks for your feedback! Unfortunately I will just be doing a lot of guess work as to what I need to change within the code. I will take a look and see if I can figure any thing out.

tspaddock commented 6 years ago

I have made a lot of modification within the code and still cannot get the bounding box to scale by the x axis only. Has it ever been possible? The only functionality that I have is drag, uniform scale and rotate by y and x. I know that a new version is coming out with the MRTK but as soon as you update any version of Unity or Holotoolkit it usually blows up your whole project. Currently I am using HUX so I cannot switch at this time. I need to finish this project before I can start the project from fresh. If there is anyway to make modifications to the existing code to make this work please let me know. Thank you for any ones hard work!

paseb commented 6 years ago

Hi @tspaddock,

Here's what I would suggest trying if you haven't. All of the logic for scaling is based on the handle types so within "HUX/Scripts/Interaction/BoundingBoxManipulate.cs" and in particular within "public static OperationEnum GetBoundingBoxOperationFromHandleType(BoundingBoxHandle.HandleTypeEnum handleType, BoundingBoxHandle.HandleTypeFlattenedEnum flattenedHandleType)".

1. Open up and add handle type enums to BoundingBoxHandle for non-uniform scaling
2. In the function above (GetBoundingBoxOperationFromHandleType) add the new handle types to the case statement.
3. Return the operation type based on the scaling axis. "return OperationEnum.ScaleX;"

Let me know that doesn't work. We're in the process of updating HUX and MRDL with MRTK as well as streamline what's in HUX for rapid proofing.

thanks,
-pat

tspaddock commented 6 years ago

Thanks Pat, I have tried what you have suggested and have not been able to write the appropriate code to make the updates happen. This could however be due to my inability to add the handle enums correctly. Thank you