void IEditorImageTargetBehaviour.InitializeImageTarget(ImageTarget imageTarget) { mTrackable = mImageTarget = imageTarget; mVirtualButtonBehaviours = new Dictionary <int, VirtualButtonBehaviour>(); // do not change the aspect ratio of user defined targets, these are set by the algorithm internally if (imageTarget.ImageTargetType == ImageTargetType.PREDEFINED) { // Handle any changes to the image target in the scene // that are not reflected in the config file Vector2 imgTargetUnitySize = GetSize(); imageTarget.SetSize(imgTargetUnitySize); } else // instead, set the aspect of the unity object to the value of the user defined target { Vector2 udtSize = imageTarget.GetSize(); // set the size of the target to the value returned from cloud reco: transform.localScale = new Vector3(udtSize.x, udtSize.x, udtSize.x); IEditorImageTargetBehaviour editorThis = this; editorThis.CorrectScale(); editorThis.SetAspectRatio(udtSize.y / udtSize.x); } }
void IEditorImageTargetBehaviour.InitializeImageTarget(ImageTarget imageTarget) { base.mTrackable = this.mImageTarget = imageTarget; this.mVirtualButtonBehaviours = new Dictionary <int, VirtualButtonAbstractBehaviour>(); if (imageTarget.ImageTargetType == ImageTargetType.PREDEFINED) { Vector2 size = this.GetSize(); imageTarget.SetSize(size); } else { Vector2 vector2 = imageTarget.GetSize(); float x = (vector2.x > vector2.y) ? vector2.x : vector2.y; base.transform.localScale = new Vector3(x, x, x); IEditorImageTargetBehaviour behaviour = this; behaviour.CorrectScale(); this.mAspectRatio = vector2.y / vector2.x; } if (base.mExtendedTracking) { this.mImageTarget.StartExtendedTracking(); } }
internal override bool InitializeTarget(Trackable trackable, bool applyTargetScaleToBehaviour) { base.InitializeTarget(trackable, applyTargetScaleToBehaviour); ImageTarget imageTarget = (ImageTarget)trackable; if (imageTarget == null) { return(false); } this.mTrackable = (this.mImageTarget = imageTarget); this.mTrackableName = trackable.Name; this.mImageTargetType = imageTarget.ImageTargetType; if (imageTarget is ImageTargetImpl) { this.mDataSetPath = ((ImageTargetImpl)imageTarget).DataSet.Path; } if (applyTargetScaleToBehaviour || imageTarget.ImageTargetType != ImageTargetType.PREDEFINED) { Vector3 size = imageTarget.GetSize(); float num = Mathf.Max(size.x, size.y); base.transform.localScale = new Vector3(num, num, num); base.CorrectScale(); this.mAspectRatio = size.y / size.x; } this.mVirtualButtonBehaviours = new Dictionary <int, VirtualButtonAbstractBehaviour>(); if (imageTarget.ImageTargetType == ImageTargetType.PREDEFINED) { Vector2 size2 = this.GetSize(); imageTarget.SetSize(size2); } if (this.mExtendedTracking) { this.mImageTarget.StartExtendedTracking(); } return(true); }
void IEditorImageTargetBehaviour.InitializeImageTarget(ImageTarget imageTarget) { mTrackable = mImageTarget = imageTarget; mVirtualButtonBehaviours = new Dictionary<int, VirtualButtonBehaviour>(); // do not change the aspect ratio of user defined targets, these are set by the algorithm internally if (imageTarget.ImageTargetType == ImageTargetType.PREDEFINED) { // Handle any changes to the image target in the scene // that are not reflected in the config file Vector2 imgTargetUnitySize = GetSize(); imageTarget.SetSize(imgTargetUnitySize); } else // instead, set the aspect of the unity object to the value of the user defined target { Vector2 udtSize = imageTarget.GetSize(); // set the size of the target to the value returned from cloud reco: transform.localScale = new Vector3(udtSize.x, udtSize.x, udtSize.x); IEditorImageTargetBehaviour editorThis = this; editorThis.CorrectScale(); editorThis.SetAspectRatio(udtSize.y / udtSize.x); } }