So I'm loading datasets at runtime and everything is working lovely. What I'm additionally trying to do, is set the image target width/height after it has been instantiated. I am currently using the following code to set the scale:
IEnumerable<TrackableBehaviour> tbs = TrackerManager.Instance.GetStateManager().GetTrackableBehaviours();
foreach (TrackableBehaviour tb in tbs)//Foreach trackable object in the scene...
if (tb.TrackableName == image.name)//If the correct target image is found
yield return null;
Note that at the point when this script is run, the image target has no children. This is correctly changing the public width/height variables as well as the transform's local scale, however it does not appear to change the scene size of the image target. ie, whatever I change the width/scale to, a 1-unit cube will fit the size of the image target. The effect is easily reproducible by:
- Add an image target to the scene and set it to detect whatever image you have handy. Start with the target width/height at 1
- Add a unit cube to the scene and place it over the image target. Don't make it a child of the image target
- While in PIE, use a webcam to track your chosen image - your 1-unit cube will be the same size of the target, as expected
- While tracking, change the width/height values in the inspector
The cube does not change perceived size or position relative to the image target. If the resizing was working, changing to a width/height of 3 should mean the image target has a scene size of 3x3, and the cube would be 1/9th the size of the image target. Changing the width/height in editor has this expected effect.
I'm pretty confused since I would imagine that an exposed and tooltip'd function allowing us to set the height of an image target would mean that it's meant to be alterable at runtime? Perhaps my implementation is incorrect? Anyone found an alternate method to get this to work?